Just a tiny implementation of the glader interface with a memory store.
Start a Glader
myglader := glader.New()Gets an item from the store
item := myglader.Get("my-item")Lists all items from the store. It returns only a list of ids.
itemList := myglader.List()It adds an item to the store by id.
item := struct {
field1 string
}{
"field1": "my data"
}
myglader.Add("my-item", item)It adds an item to the store by id, with Time To Live. To do so, use ttl glader using myglader as store
item := struct {
field1 string
}{
"field1": "my data"
}
myTTLglader := ttl.Neew(myglader, time.Second)
myTTLglader.Add("my-item", item)Item will be deleted after 1 second
Deletes an item to the store by id.
myglader.Delete("my-item")Item will be deleted after 1 second