Documentation
¶
Index ¶
- Constants
- func IsInvalidatingSentinelValue(v CacheSentinel) bool
- func IsTombstoneSentinel(data string) bool
- 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) IsInvalidatingSentinelValue(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 ¶
const ( // SentinelTTL value when setting a sentinel value in the cache SentinelTTL = 60 * time.Second // InvalidationTombstoneTTL value when setting a tombstone value in the cache for cross region invalidation InvalidationTombstoneTTL = 5 * time.Second // TombstoneSentinel represents the sentinel value for a tombstone TombstoneSentinel CacheSentinel = "Tombstone" // NoLockSentinel represents the sentinel value for no lock NoLockSentinel CacheSentinel = "" )
Variables ¶
This section is empty.
Functions ¶
func IsInvalidatingSentinelValue ¶ added in v0.7.6
func IsInvalidatingSentinelValue(v CacheSentinel) bool
IsInvalidatingSentinelValue returns true if the sentinel requires invalidating the value across other
func IsTombstoneSentinel ¶ added in v0.7.6
IsTombstoneSentinel returns true if the given data is a tombstone sentinel
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
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) IsInvalidatingSentinelValue ¶ added in v0.7.6
func (c *WriteThroughCacheSentinelManager) IsInvalidatingSentinelValue(v CacheSentinel) bool
IsInvalidatingSentinelValue returns true if the sentinel requires invalidating the value across other
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