Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement TTL for lattice keys #55

Open
tailhook opened this issue Sep 5, 2017 · 0 comments
Open

Implement TTL for lattice keys #55

tailhook opened this issue Sep 5, 2017 · 0 comments

Comments

@tailhook
Copy link
Collaborator

tailhook commented Sep 5, 2017

Motivation

This is useful to keep notifications for short-living tasks, but not letting them introduce a memory leak if user sessions are long.

Implementation

The idea is to add expires_in key for lattice keys:

POST /v1/lattice/test-chat-rooms HTTP/1.1
{"shared": {
    "room1": {"last_message_counter": 123,
              "expires_in": 300},
 "private": {
   "7777": {
     "room1": {
       "last_seen_counter": 120,
       "expires_in": 300
     }
  }
}

The TTLs for public and private keys are separate, but for user to see public data both private and public items should be valid.

Questions

  1. Maybe units in "expires_in" ? ("30 sec", "10 min")
  2. Or maybe deadline-style api: "expires_at": "2017-09-05T18:00:00Z"
  3. To be able to enumerate tasks when user went offline, we also need to keep private part of the lattice for as long as expiration time rather than session lifetime
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant