cache

package
v0.0.0-...-455f444 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckLocalFileExistence

func CheckLocalFileExistence(fileLocation string) bool

func GetAllKeysFromCategory

func GetAllKeysFromCategory(cacheConn *redis.Client, category string) (keys []string, err error)

func GetDataFromCache

func GetDataFromCache(cacheConn *redis.Client, key string) (value []byte, err error)

func GetPackageDataFromCache

func GetPackageDataFromCache(cacheConn *redis.Client, poolPrefix string) (string, []byte, error)

func JoinData

func JoinData(chunks [][]byte) []byte

func Md5sum

func Md5sum(data []byte) string

func NewCacheConnection

func NewCacheConnection(addr string, username string, password string, db int) *redis.Client

func PutDataOnCache

func PutDataOnCache(cacheConn *redis.Client, key string, value []byte, expiration time.Duration) (err error)

func PutPackageDataOnCache

func PutPackageDataOnCache(cacheConn *redis.Client, fileName string, data []byte, splitLimit int, poolPrefix string, expiration time.Duration) (err error)

func ReadFileFromDisk

func ReadFileFromDisk(fileLocation string) (data []byte, fileName string, err error)

func RegisterNode

func RegisterNode(cacheConn *redis.Client, category string, nodeID string, value string, expiration time.Duration) (err error)

func RemoveNode

func RemoveNode(cacheConn *redis.Client, category string, nodeID string) (err error)

func SendKeepAlive

func SendKeepAlive(cacheConn *redis.Client, category string, nodeID string, value string, ttl int)

func SplitData

func SplitData(data []byte, limit int) [][]byte

func UnzipPackageBytesToDisk

func UnzipPackageBytesToDisk(data []byte, dest string) ([]string, error)

func WriteFileToDisk

func WriteFileToDisk(fileLocation string, data []byte) (err error)

Types

type PackageMetaData

type PackageMetaData struct {
	FileName string
	Size     int
	Md5sum   string
	Chunks   int
}

Jump to

Keyboard shortcuts

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