Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BigCache ¶
type BigCache struct {
// contains filtered or unexported fields
}
BigCache is fast, concurrent, evicting cache created to keep big number of entries without impact on performance. It keeps entries on heap but omits GC for them. To achieve that operations on bytes arrays take place, therefore entries (de)serialization in front of the cache will be needed in most use cases.
func NewBigCache ¶
NewBigCache initialize new instance of BigCache
type Config ¶
type Config struct { // Number of cache shards Shards int // Time after which entry can be evicted LifeWindow time.Duration // Max number of entries in life window. Used to allocate proper size of cache in every shard. // When proper value is set then cache will not allocate additional memory MaxEntriesInWindow int // Max size of entry in bytes. Used to allocate proper size of cache in every shard. MaxEntrySize int // Verbose mode prints information about new memory allocation Verbose bool }
Config for BigCache
func DefaultConfig ¶
DefaultConfig initializes config with default values. When load for BigCache can be predicted in advance then it is better to use custom config.
type EntryNotFoundError ¶
type EntryNotFoundError struct {
// contains filtered or unexported fields
}
EntryNotFoundError is an error type struct which is returned when entry was not found for provided key
func (EntryNotFoundError) Error ¶
func (e EntryNotFoundError) Error() string
Error returned when entry does not exist.