cached_stub

package
v0.0.0-...-aeb4a1d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package cached_stub is used for caching ledger data and arbitrary data to improve transaction efficiency.

Package cached_stub is used for caching ledger data and arbitrary data to improve transaction efficiency.

Package cached_stub is used for caching ledger data and arbitrary data to improve transaction efficiency.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachedStubInterface

type CachedStubInterface interface {
	shim.ChaincodeStubInterface

	// GetCache gets a stored object (interface{}) from the cache.
	// Returns nil and an error if key does not exist in the cache.
	// Note that the object is stored as an interface.
	// This implies that the actual value stored in the cache is a pointer to the caller's object.
	// Hence, if the caller makes changes to the object (i.e []byte type) in solution chaincode,
	// the changed value might remain when the caller gets the object from the cache.
	// It is therefore the caller's responsibility to prevent side effects in solution chaincode.
	GetCache(key string) (interface{}, error)

	// PutCache stores an object as an interface in the cache.
	PutCache(key string, value interface{}) error

	// DelCache deletes an object from the cache by setting its value in the cache to nil.
	DelCache(key string) error
}

CachedStubInterface extends Fabric Shim's ChaincodeStubInterface, please refer to Shim's docs for more info.

func NewCachedStub

func NewCachedStub(stub shim.ChaincodeStubInterface, options ...bool) CachedStubInterface

NewCachedStub creates a new instance of cachedStub

options: enable_get_cache (default: true), enable_put_cache (default: false) cache for storing arbitrary data is always enabled

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL