Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ShardCache ¶
type ShardCache struct {
// contains filtered or unexported fields
}
ShardCache will keep track and shard keys based on the number of shards it holds around mutexes so this is safe for concurrent use
func New ¶
func New(shards uint64) *ShardCache
New returns a ShardCache with the number of shards which must be a power of 2
func (*ShardCache) Delete ¶
func (sc *ShardCache) Delete(key uint64)
Delete a key in the cache and use a write lock only for the shard that has the value leaving all other shards available for reads
func (*ShardCache) Get ¶
func (sc *ShardCache) Get(key uint64) interface{}
Get a key from the cache and only use a read lock to access it
func (*ShardCache) Set ¶
func (sc *ShardCache) Set(key uint64, value interface{})
Set a key in the cache and use a write lock only for the shard that will hold the value leaving all other shards available for reads
Click to show internal directories.
Click to hide internal directories.