import "github.com/cheshir/ttlcache"
AnyKey creates key from anything. Should not be used for large datasets. For complex keys you can write your own hashing implementation.
ByteKey creates key from byte value.
BytesKey creates key from slice of bytes value.
Int16Key creates key from int16 value.
Int32Key creates key from int32 value.
Int64Key creates key from int64 value.
Int8Key creates key from int8 value.
IntKey creates key from int value.
StringKey creates key from string value.
Uint16Key creates key from uint16 value.
Uint32Key creates key from uint32 value.
Uint64Key creates key from uint64 value.
Uint8Key creates key from uint8 value.
type Cache struct {
// contains filtered or unexported fields
}
Cache represents key-value storage.
New creates key-value storage. resolution – configures cleanup manager. Cleanup operation locks storage so think twice before setting it to small value.
Close stops cleanup manager and removes records from storage.
Delete removes record from storage.
Get returns stored record. The first returned variable is a stored value. The second one is an existence flag like in the map.
Set adds value to the cache with given ttl. ttl value should be a multiple of the resolution time value.
Package ttlcache imports 4 packages (graph). Updated 2021-01-13. Refresh now. Tools for package owners.