Documentation ¶
Index ¶
- type CacheKey
- type CacheSentinel
- type SentinelType
- type WriteThroughCacheSentinelManager
- func (c *WriteThroughCacheSentinelManager) CanSetSentinel(currVal CacheSentinel, newVal CacheSentinel) bool
- func (c *WriteThroughCacheSentinelManager) CanSetValue(currVal string, val string, sentinel CacheSentinel) (set bool, clear bool, conflict bool)
- func (c *WriteThroughCacheSentinelManager) GenerateSentinel(stype SentinelType) CacheSentinel
- func (c *WriteThroughCacheSentinelManager) IsDeleteSentinelPrefix(v CacheSentinel) bool
- func (c *WriteThroughCacheSentinelManager) IsReadSentinelPrefix(v CacheSentinel) bool
- func (c *WriteThroughCacheSentinelManager) IsSentinelValue(v string) bool
- func (c *WriteThroughCacheSentinelManager) IsWriteSentinelPrefix(v CacheSentinel) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheKey ¶ added in v0.7.1
type CacheKey string
CacheKey is the type storing the cache key name. It is a string but is a separate type to avoid bugs related to mixing up strings.
type CacheSentinel ¶
type CacheSentinel string
CacheSentinel is the type storing in the cache marker for in progress operation
const NoLockSentinel CacheSentinel = ""
NoLockSentinel represents the sentinel value for no lock
const TombstoneSentinel CacheSentinel = "Tombstone"
TombstoneSentinel represents the sentinel value for a tombstone
type SentinelType ¶
type SentinelType string
SentinelType captures the type of the sentinel for different operations
const ( Create SentinelType = "create" Update SentinelType = "update" Delete SentinelType = "delete" Read SentinelType = "read" )
SentinelType names
type WriteThroughCacheSentinelManager ¶
type WriteThroughCacheSentinelManager struct { }
WriteThroughCacheSentinelManager is the implementation of sentinel management for a write through cache
func NewWriteThroughCacheSentinelManager ¶
func NewWriteThroughCacheSentinelManager() *WriteThroughCacheSentinelManager
NewWriteThroughCacheSentinelManager creates a new BaseCacheSentinelManager
func (*WriteThroughCacheSentinelManager) CanSetSentinel ¶
func (c *WriteThroughCacheSentinelManager) CanSetSentinel(currVal CacheSentinel, newVal CacheSentinel) bool
CanSetSentinel returns true if new sentinel can be set for the given current sentinel
func (*WriteThroughCacheSentinelManager) CanSetValue ¶
func (c *WriteThroughCacheSentinelManager) CanSetValue(currVal string, val string, sentinel CacheSentinel) (set bool, clear bool, conflict bool)
CanSetValue returns operation to take given existing key value, new value, and sentinel for the operation
func (*WriteThroughCacheSentinelManager) GenerateSentinel ¶
func (c *WriteThroughCacheSentinelManager) GenerateSentinel(stype SentinelType) CacheSentinel
GenerateSentinel generates a sentinel value for the given sentinel type
func (*WriteThroughCacheSentinelManager) IsDeleteSentinelPrefix ¶
func (c *WriteThroughCacheSentinelManager) IsDeleteSentinelPrefix(v CacheSentinel) bool
IsDeleteSentinelPrefix returns true if the sentinel value is a delete sentinel
func (*WriteThroughCacheSentinelManager) IsReadSentinelPrefix ¶
func (c *WriteThroughCacheSentinelManager) IsReadSentinelPrefix(v CacheSentinel) bool
IsReadSentinelPrefix returns true if the sentinel value is a read sentinel
func (*WriteThroughCacheSentinelManager) IsSentinelValue ¶
func (c *WriteThroughCacheSentinelManager) IsSentinelValue(v string) bool
IsSentinelValue returns true if the value passed in is a sentinel value
func (*WriteThroughCacheSentinelManager) IsWriteSentinelPrefix ¶
func (c *WriteThroughCacheSentinelManager) IsWriteSentinelPrefix(v CacheSentinel) bool
IsWriteSentinelPrefix returns true if the sentinel value is a write sentinel