cosmos-sdk: Index | Files

package cache

import ""


Package Files



var (

    // DefaultCommitKVStoreCacheSize defines the persistent ARC cache size for a
    // CommitKVStoreCache.
    DefaultCommitKVStoreCacheSize uint = 1000

type CommitKVStoreCache Uses

type CommitKVStoreCache struct {
    // contains filtered or unexported fields

CommitKVStoreCache implements an inter-block (persistent) cache that wraps a CommitKVStore. Reads first hit the internal ARC (Adaptive Replacement Cache). During a cache miss, the read is delegated to the underlying CommitKVStore and cached. Deletes and writes always happen to both the cache and the CommitKVStore in a write-through manner. Caching performed in the CommitKVStore and below is completely irrelevant to this layer.

func NewCommitKVStoreCache Uses

func NewCommitKVStoreCache(store types.CommitKVStore, size uint) *CommitKVStoreCache

func (*CommitKVStoreCache) CacheWrap Uses

func (ckv *CommitKVStoreCache) CacheWrap() types.CacheWrap

CacheWrap returns the inter-block cache as a cache-wrapped CommitKVStore.

func (*CommitKVStoreCache) Delete Uses

func (ckv *CommitKVStoreCache) Delete(key []byte)

Delete removes a key/value pair from both the write-through cache and the underlying CommitKVStore.

func (*CommitKVStoreCache) Get Uses

func (ckv *CommitKVStoreCache) Get(key []byte) []byte

Get retrieves a value by key. It will first look in the write-through cache. If the value doesn't exist in the write-through cache, the query is delegated to the underlying CommitKVStore.

func (*CommitKVStoreCache) Set Uses

func (ckv *CommitKVStoreCache) Set(key, value []byte)

Set inserts a key/value pair into both the write-through cache and the underlying CommitKVStore.

type CommitKVStoreCacheManager Uses

type CommitKVStoreCacheManager struct {
    // contains filtered or unexported fields

CommitKVStoreCacheManager maintains a mapping from a StoreKey to a CommitKVStoreCache. Each CommitKVStore, per StoreKey, is meant to be used in an inter-block (persistent) manner and typically provided by a CommitMultiStore.

func NewCommitKVStoreCacheManager Uses

func NewCommitKVStoreCacheManager(size uint) *CommitKVStoreCacheManager

func (*CommitKVStoreCacheManager) GetStoreCache Uses

func (cmgr *CommitKVStoreCacheManager) GetStoreCache(key types.StoreKey, store types.CommitKVStore) types.CommitKVStore

GetStoreCache returns a Cache from the CommitStoreCacheManager for a given StoreKey. If no Cache exists for the StoreKey, then one is created and set. The returned Cache is meant to be used in a persistent manner.

func (*CommitKVStoreCacheManager) Reset Uses

func (cmgr *CommitKVStoreCacheManager) Reset()

Reset resets in the internal caches.

func (*CommitKVStoreCacheManager) Unwrap Uses

func (cmgr *CommitKVStoreCacheManager) Unwrap(key types.StoreKey) types.CommitKVStore

Unwrap returns the underlying CommitKVStore for a given StoreKey.

Package cache imports 4 packages (graph) and is imported by 3 packages. Updated 2020-07-25. Refresh now. Tools for package owners.