|
|
@ -22,10 +22,10 @@ c := cache.New(5*time.Minute, 30*time.Second)
|
|
|
|
// Set the value of the key "foo" to "bar", with the default expiration time
|
|
|
|
// Set the value of the key "foo" to "bar", with the default expiration time
|
|
|
|
c.Set("foo", "bar", 0)
|
|
|
|
c.Set("foo", "bar", 0)
|
|
|
|
|
|
|
|
|
|
|
|
// Set the value of the key "baz" to "yes", with no expiration time
|
|
|
|
// Set the value of the key "baz" to 42, with no expiration time
|
|
|
|
// (the item won't be removed until it is re-set, or removed using
|
|
|
|
// (the item won't be removed until it is re-set, or removed using
|
|
|
|
// c.Delete("baz")
|
|
|
|
// c.Delete("baz")
|
|
|
|
c.Set("baz", "yes", -1)
|
|
|
|
c.Set("baz", 42, -1)
|
|
|
|
|
|
|
|
|
|
|
|
// Get the string associated with the key "foo" from the cache
|
|
|
|
// Get the string associated with the key "foo" from the cache
|
|
|
|
foo, found := c.Get("foo")
|
|
|
|
foo, found := c.Get("foo")
|
|
|
|