Documentation
¶
Index ¶
- Constants
- type MemoryStore
- func (c *MemoryStore) Close()
- func (c *MemoryStore) Conn(ctx context.Context) (remember.Cacher, error)
- func (c *MemoryStore) Forget(key string) error
- func (c *MemoryStore) ForgetAll() error
- func (c *MemoryStore) Get(key string) (_ interface{}, found bool, _ error)
- func (c *MemoryStore) Set(key string, expiration time.Duration, itemToStore interface{}) error
- func (c *MemoryStore) StorePointer() bool
Constants ¶
const NoExpiration time.Duration = -1
NoExpiration is used to indicate that data should not expire from the cache.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore is used to create an in-memory cache.
func NewMemoryStore ¶
func NewMemoryStore(cleanupInterval time.Duration) *MemoryStore
NewMemoryStore creates an in-memory cache where the expired items are deleted based on the cleanupInterval duration.
func NewMemoryStoreFrom ¶
func NewMemoryStoreFrom(cache *cache.Cache) *MemoryStore
NewMemoryStoreFrom creates an in-memory cache directly from a *cache.Cache object.
func (*MemoryStore) Close ¶
func (c *MemoryStore) Close()
Close returns the connection back to the pool for storage drivers that utilize a pool. For this driver, it does nothing.
func (*MemoryStore) Conn ¶
func (c *MemoryStore) Conn(ctx context.Context) (remember.Cacher, error)
Conn does nothing for this storage driver.
func (*MemoryStore) Forget ¶
func (c *MemoryStore) Forget(key string) error
Forget clears the value from the cache for the particular key.
func (*MemoryStore) ForgetAll ¶
func (c *MemoryStore) ForgetAll() error
ForgetAll clears all values from the cache.
func (*MemoryStore) Get ¶
func (c *MemoryStore) Get(key string) (_ interface{}, found bool, _ error)
Get returns a value from the cache if the key exists.
func (*MemoryStore) Set ¶
func (c *MemoryStore) Set(key string, expiration time.Duration, itemToStore interface{}) error
Set sets a item into the cache for a particular key.
func (*MemoryStore) StorePointer ¶
func (c *MemoryStore) StorePointer() bool
StorePointer sets whether a storage driver requires itemToStore to be stored as a pointer or as a concrete value.