cache

package
v0.0.0-...-fbcb358 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package cache sets and gets data from memcache and datastore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteDatastore

func DeleteDatastore(ctx context.Context, key *datastore.Key) error

DeleteDatastore deletes key from datastore. nil is returned if the key isn't present.

func DeleteMemcache

func DeleteMemcache(ctx context.Context, key string) error

DeleteMemcache deletes key from memcache. nil is returned if the key isn't present.

func GetDatastore

func GetDatastore(ctx context.Context, key *datastore.Key, dst any) (ok bool, err error)

GetDatastore fetches an object from datastore and saves it to dst. If the object isn't present, ok is false and err is nil.

func GetMemcache

func GetMemcache(ctx context.Context, key string, dst any) (ok bool, err error)

GetMemcache fetches a JSON object from memcache and saves it to dst. If the object isn't present, ok is false and err is nil.

func LoadJSONProp

func LoadJSONProp(props []datastore.Property, dst any) error

LoadJSONProp implements datastore.PropertyLoadSaver's Load method.

func SaveJSONProp

func SaveJSONProp(src any) ([]datastore.Property, error)

SaveJSONProp implements datastore.PropertyLoadSaver's Save method.

func SetDatastore

func SetDatastore(ctx context.Context, key *datastore.Key, src any) error

SetDatastore saves src at key in datastore. If the update fails, the stale object (if present) is deleted.

func SetMemcache

func SetMemcache(ctx context.Context, key string, src any) error

SetMemcache saves JSON object src at key in memcache. If the update fails, the stale object (if present) is deleted.

Types

type Type

type Type int

Type describes a cache type.

const (
	Memcache Type = iota
	Datastore
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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