Categorygithub.com/rupor-github/bigcache/v3
modulepackage
3.0.0
Repository: https://github.com/rupor-github/bigcache.git
Documentation: pkg.go.dev

# README

fb2converter

converts fb2 files to epub, kepub, mobi, azw3

GoDoc Go Report Card


BigCache

Fast, concurrent, evicting in-memory cache written to keep big number of entries without impact on performance. BigCache keeps entries on heap but omits GC for them. To achieve that, operations on byte slices take place, therefore entries (de)serialization in front of the cache will be needed in most use cases.

Requires Go 1.13 or newer.

This is very reluctant fork of original BigCache v2.2.2. For any documentation, issues or discussion - please, visit original project.

Original is presently unstable (see issues there - in my production tests I cannot keep it up for more than 10 minutes before it dies with index out of range) and when working on a fix I got carried away with too many changes. While cleaning I attempted to keep code as efficient as it was while making it somewhat easier to read and modify. Original code has unused functions (result of functionality move to shard.go), unnecessary flags trying to fix edge conditions (q.full? really?), too many OnRemove callbacks in attempt to keep backward compatibility, outdated logger (and overall configuration - to some degree). Locking iterator design is a bit strange for highly concurrent code.

All in all I got a feeling that contributors are more interested in a expanding feature set with additional callbacks rather than having readable, simple, stable and performing code base as was the case for a very long time with v1.

Until I decide if I want to make upstream PR I will keep this fork - it is presently benchmarks as good or faster as original bigcache at v2.2.2 and has some additional functionality I need (see GetWithProcesssing).

License

BigCache is released under the Apache 2.0 license (see LICENSE)

# Packages

No description provided by the author

# Functions

DefaultConfig initializes config with sane default values.
DefaultLogger returns implementation backed by stdlib's log.
NewBigCache initializes new instance of BigCache.

# Constants

key was removed as a result of Delete() call.
key is past its LifeWindow.
No description provided by the author
key is the oldest and the cache size was at its maximum when Set() was called, or entry size exceeded the maximum shard size.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

BigCache is fast, concurrent, evicting cache created to keep big number of entries without impact on performance.
CacheEntry is used to interface between bigcache and shards and to provide user with access to low level cache memory when necessary.
Config for BigCache.
Stats stores cache statistics.

# Interfaces

Hasher is responsible for generating unsigned, 64 bit hash of provided string.
Logger interface.

# Type aliases

No description provided by the author
Processor is a closure supplied to set of WithProcessing functions to take ownership of data []byte avoiding extra memory allocation and copy.
RemoveReason is a value used to signal to the user why a particular key was removed in the OnRemove callback.