High performance and lightweight in-memory cache library with LRU and FIFO support as well as memory-usage-based-eviction
MIT License
Bot releases are hidden (Show)
Full Changelog: https://github.com/TwiN/gocache/compare/v2.2.1...v2.2.2
Published by TwiN 7 months ago
Full Changelog: https://github.com/TwiN/gocache/compare/v2.2.0...v2.2.1
Published by TwiN almost 2 years ago
const
instead of var
Full Changelog: https://github.com/TwiN/gocache/compare/v2.1.2...v2.2.0
Published by TwiN almost 2 years ago
Full Changelog: https://github.com/TwiN/gocache/compare/v2.1.1...v2.1.2
Published by TwiN about 2 years ago
chore: Update Go to 1.19
Published by TwiN about 2 years ago
feat: Add DeleteKeysByPattern method
Published by TwiN over 2 years ago
Published by TwiN almost 3 years ago
As of now, this library is strictly an in-memory cache and has 0 dependencies.
This is a breaking change, therefore the version is going from v1.x to v2.x
Published by TwiN about 3 years ago
⚠ Migrated TwinProduction/gocache to TwiN/gocache
Published by TwiN over 3 years ago
Minor fixes
Published by TwiN over 3 years ago
Published by TwiN over 3 years ago
Replaced bolt by bbolt for persistence
Published by TwiN over 3 years ago
Added Cache.GetValue
Published by TwiN almost 4 years ago
Cache.WithForceNilInterfaceOnNilPointer
In Go, an interface is only nil if both its type and value are nil, which means that a nil pointer
(e.g. (*Struct)(nil)
) retains its type when passed as an interface{}
, and the unmodified value returned from
Cache.Get
, for instance, would return false when compared with nil.
This new configuration allows a cache to bypass that counter-intuitive behavior by setting the value to nil
if a nil
pointer is passed as the value parameter to a write function (Set
, SetWithTTL
and SetAll
), which effectively sets both the type and the value of the cache entry to nil, thus allowing the statement value == nil
to be true.
The default value for that new configuration is true
, because this behavior is more intuitive.
Published by TwiN almost 4 years ago
Cache.Stats()
no longer returns a pointerPublished by TwiN almost 4 years ago
Fixed issue with Cache.Stats().ExpiredKeys
not incrementing on active deletion of expired keys
Published by TwiN almost 4 years ago
GetKeysByPattern
no longer returns expired keysStopJanitor
when the janitor wasn't startedPublished by TwiN almost 4 years ago
GetAll
to GetByKeys
and add GetAll
functionI don't make it a habit of making breaking changes, especially without increasing the major version in the tag, but since there are very few people using this library, I'll make an exception.
Published by TwiN almost 4 years ago
RelevantTimestamp
is now updated when an existing entry is modifiedused_memory
, used_memory_human
, used_memory_dataset
and used_memory_dataset_human
to INFO
outputThe switch to Bolt is a breaking change, but since this library isn't used by many at the moment - much less the persistence feature - not updating the major version should be acceptable.
Published by TwiN almost 4 years ago
Cache
struct are now exposed through functions rather than being directly accessibleThe last change of the gocache
section is a breaking change, but considering the meager popularity of the repository at the moment, not updating the major version should be acceptable.