v1.0.0

Type Reference

Last updated


This page lists the fields and purpose of every exported type in go-redis-fallback.

Configuration Types


TypePurposeSee
ConfigThe only argument to New; holds Redis, Log, Option, EmailConfiguration
RedisConnection settings: Host, Port, Password, DBConfiguration
OptionsFallback and recovery parameters: DBPath, MaxRetry, MaxQueue, TimeToWrite, TimeToCheckConfiguration
LogType alias of Log from github.com/pardnchiu/go-loggerConfiguration
LoggerType alias of Logger from github.com/pardnchiu/go-logger; used internally, never passed in Config—
EmailConfigNotification settings; currently inactiveConfiguration

RedisFallback


The instance type returned by New. All fields are unexported; use it only through Get / Set / Del / Close. Methods are in the API Reference.

Cache


  1. type Cache struct {
  2. Key string `json:"key"`
  3. Data interface{} `json:"data"`
  4. Type string `json:"type"`
  5. Timestamp int64 `json:"timestamp"`
  6. TTL int64 `json:"ttl,omitempty"`
  7. }

The data structure shared by the memory cache and the local JSON files. In normal mode Get also parses Redis values into this structure, but Set does not write this structure to Redis; see Normal-Mode Read. Field descriptions are in Local File Format.

Internal Types


These types are exported but only created and used inside the library; callers have no constructor or methods for them:
TypeFieldsPurpose
WriterAll unexportedThe fallback batch writer: queue, pending map, ticker
WriteRequestKey string, Data interface{}One write sent to the Writer queue; Data is actually a Cache
PathAll unexportedThe file path computed by getPath
中文