schema

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheConf added in v0.2.6

type CacheConf struct {
	// Name of the cache
	Name string
	// Duration for cache to be expired
	CacheDuration time.Duration
	// True if the cache duration should be randomized
	RandomizedDuration bool
	// Redis configuration if this cache is used with Redis Cluster
	RedisConf *RedisConf
	// Configuration for scheduler to remove expired entry
	SchedulerConf *SchedulerConf
	// (Optional) With verbose mode, the Cache will print out more logs for debugging.
	// If nil, the Cache will use default logger and log level will be set based on ENV_VERBOSE environment variable..
	Logger *util.Logger
}

type ProcessFunc added in v0.5.0

type ProcessFunc func(value interface{}) (err error)

A function that process data entry in cache. Returns error if any.

type RESULT

type RESULT int
const (
	VALID RESULT = iota
	EXPIRED
	NOT_FOUND
	ERROR
)

func (RESULT) String added in v0.5.0

func (r RESULT) String() string

type RedisConf added in v0.2.6

type RedisConf struct {
	// Namespace for database to store KEY and VALUE in same logical storage. Usually service name if the appliction consist of multiple applications.
	/* Default: Name value in CacheConf */
	Namespace string
	// Group name to prevent key duplication in same namespcae. E.g., if you want to use session ID as a KEY in differnt data cetegories, it may cause key duplication among data categories.
	/* Default: empty */
	Group string
	// A list of server address for Redis Cluster
	/* [host1:port1, host2:port2, ... hostN:portN] */
	ServerAddresses []string
	Username        string
	Password        string
}

type SchedulerConf added in v0.5.0

type SchedulerConf struct {
	// Seconds Minutes Hours Day_of_month Month Day_of_week  (e.g. "0 0 12 * * *" means 12:00:00 PM every day)
	CronExprForScheduler string
	// A function that will be called before removing the expired entry
	PreProcess ProcessFunc
	// A function that will be called after removing the expired entry
	PostProcess ProcessFunc
}

Jump to

Keyboard shortcuts

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