Documentation ¶
Overview ¶
Package cache provides a lightweight engine for storing key/value pairs.
Index ¶
Constants ¶
View Source
const ( ExpiredAt = 7 * 24 * time.Hour // The expiry time for storage engine entries. SubDir = "cacheDB" // The name of the storage engine subdirectory. )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache int // Cache is the type of storage engine.
func (Cache) Path ¶
Path returns the absolute path to the storage engine directory. If the directory does not exist it will be created.
func (Cache) Write ¶
Write writes a key/value pair to the storage engine. The key/value pair will be deleted after the ttl time duration has elapsed. If ttl is 0 then the key/value pair will immediately expire.
func (Cache) WriteNoExpire ¶
WriteNoExpire writes a key/value pair to the storage engine. The key/value pair will not expire.
Click to show internal directories.
Click to hide internal directories.