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

Add key expiration (ttl) #6

Closed
ashcrow opened this issue May 14, 2015 · 6 comments
Closed

Add key expiration (ttl) #6

ashcrow opened this issue May 14, 2015 · 6 comments
Assignees
Milestone

Comments

@ashcrow
Copy link
Owner

ashcrow commented May 14, 2015

A request came in asking to support ttl for keys. Both consultant etcd support ttl but in different ways. A single interface should be created so that switching is seamless.

@ashcrow ashcrow self-assigned this May 14, 2015
@ashcrow ashcrow added this to the 0.1.0 milestone May 14, 2015
@ashcrow
Copy link
Owner Author

ashcrow commented May 18, 2015

@ashcrow
Copy link
Owner Author

ashcrow commented May 22, 2015

Work started in https://github.com/ashcrow/consuloretcd/tree/ttl

Looked quickly at the consul implementation but it wasn't nearly as clear how to make a session expire a key.

@ashcrow
Copy link
Owner Author

ashcrow commented Jun 13, 2015

Took a few times through the doc to realize that the session has to be made first and then the key must be created with the session. This seems to work. I'll try to implement it shortly.

curl example

The following expires the key after 30 seconds.

$ curl -H "Content-Type: application/json" -d '{"TTL": "30s", "Behavior": "delete"}' -X PUT http://127.0.0.1:8500/v1/session/create
{ "ID":"ad91aa2d-c562-182f-9938-7a913a32022e"}
$ curl -X PUT -d "test" http://127.0.0.1:8500/v1/kv/test2?acquire=ad91aa2d-c562-182f-9938-7a913a32022e

@ashcrow
Copy link
Owner Author

ashcrow commented Jun 13, 2015

689cf0c implementes sessions for TTL in consul. Needs some clean up work but functionality should be there. Waiting on some user testing.

@ashcrow
Copy link
Owner Author

ashcrow commented Jun 16, 2015

User testing came back positive.

@ashcrow
Copy link
Owner Author

ashcrow commented Jun 16, 2015

Merged in #7

@ashcrow ashcrow closed this as completed Jun 16, 2015
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