Documentation
¶
Index ¶
- Variables
- type Cache
- func (cache *Cache[T]) Clear() error
- func (cache *Cache[T]) Get(key string) (*T, error)
- func (cache *Cache[T]) Set(item T, key ...string) (err error)
- func (cache *Cache[T]) SetWithExpiration(item T, expiration time.Duration, key ...string) (err error)
- func (cache *Cache[T]) WithEncryptionKey(key []byte) *Cache[T]
- func (cache *Cache[T]) WithExpiration(expiration time.Duration) *Cache[T]
- type CacheOption
Constants ¶
This section is empty.
Variables ¶
View Source
var VERSION = "0.2.0" + commit
VERSION is the version of this library
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T interface{}] struct { Name string Items sync.Map Expiration time.Duration // contains filtered or unexported fields }
Cache is a cache
func (*Cache[T]) SetWithExpiration ¶
func (cache *Cache[T]) SetWithExpiration(item T, expiration time.Duration, key ...string) (err error)
SetWithExpiration sets an item in the cache with a custom expiration
func (*Cache[T]) WithEncryptionKey ¶
WithEncryptionKey sets the encryption key for the cache
type CacheOption ¶
type CacheOption int
const ( // CacheOptionNone is the default option CacheOptionNone CacheOption = iota // CacheOptionPersistent tells the cache to persist the data CacheOptionPersistent )
Click to show internal directories.
Click to hide internal directories.