Documentation ¶
Overview ¶
Package storer is implements a cache deleting its entries after each interval.
Index ¶
Constants ¶
View Source
const ( // DefaultTTL is default ttl of the ache entries. DefaultTTL = 10 * time.Minute // DefaultInterval is default interval to execute the "garbage collection" of the cache. DefaultInterval = 15 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryStore ¶
type InMemoryStore struct {
// contains filtered or unexported fields
}
InMemoryStore is similar to the sdk one, the main difference is cleanCache method executed each interval.
func NewInMemoryStore ¶
func NewInMemoryStore(ttl time.Duration, interval time.Duration, logger *logrus.Logger) *InMemoryStore
NewInMemoryStore will create and initialize an InMemoryStore.
func (InMemoryStore) Delete ¶
func (ims InMemoryStore) Delete(_ string) error
Delete implementation to respect interface.
func (InMemoryStore) Get ¶
func (ims InMemoryStore) Get(key string, valuePtr interface{}) (int64, error)
Get gets the value associated to a given key and stores it in the value referenced by the pointer passed as second argument.
func (*InMemoryStore) Save ¶
func (ims *InMemoryStore) Save() error
Save implementation to respect interface.
func (InMemoryStore) Set ¶
func (ims InMemoryStore) Set(key string, value interface{}) int64
Set stores a value for a given key.
func (InMemoryStore) StopVacuum ¶
func (ims InMemoryStore) StopVacuum()
StopVacuum Stops the goroutine in charge of the vacuum of the cache.
Click to show internal directories.
Click to hide internal directories.