Discover Packages
github.com/upper/db/v4
internal
cache
package
Version:
v4.2.0
Opens a new window with list of versions in this module.
Published: Jun 29, 2021
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0 modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
Documentation
Documentation
¶
func Hash(v interface{}) string
Hash returns a hash of the given struct.
Cache holds a map of volatile key -> values.
NewCache initializes a new caching space with default settings.
NewCacheWithCapacity initializes a new caching space with the given
capacity.
Clear generates a new memory space, leaving the old memory unreferenced, so
it can be claimed by the garbage collector.
Read attempts to retrieve a cached value as a string, if the value does not
exists returns an empty string and false.
ReadRaw attempts to retrieve a cached value as an interface{}, if the value
does not exists returns nil and false.
Write stores a value in memory. If the value already exists its overwritten.
type HasOnPurge interface {
OnPurge()
}
HasOnPurge type is (optionally) implemented by cache objects to clean after
themselves.
type Hashable interface {
Hash() string
}
Hashable types must implement a method that returns a key. This key will be
associated with a cached value.
String returns a Hashable that produces a hash equal to the given string.
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.