Documentation
¶
Index ¶
- Constants
- func IsInvalidatingSentinelValue(v CacheSentinel) bool
- func IsTombstoneSentinel(data string) bool
- type CacheKey
- type CacheSentinel
- type SentinelType
- type WriteThroughCacheSentinelManager
- func (c *WriteThroughCacheSentinelManager) CanAlwaysSetSentinel(newVal CacheSentinel) bool
- func (c *WriteThroughCacheSentinelManager) CanSetSentinelGivenCurrVal(currVal CacheSentinel, newVal CacheSentinel) bool
- func (c *WriteThroughCacheSentinelManager) CanSetValue(currVal string, val string, sentinel CacheSentinel) (set bool, clear bool, conflict bool, refresh 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) CanAlwaysSetSentinel ¶ added in v1.0.0
func (c *WriteThroughCacheSentinelManager) CanAlwaysSetSentinel(newVal CacheSentinel) bool
CanAlwaysSetSentinel returns true if the sentinel can be set without reading current value
func (*WriteThroughCacheSentinelManager) CanSetSentinelGivenCurrVal ¶ added in v1.0.0
func (c *WriteThroughCacheSentinelManager) CanSetSentinelGivenCurrVal(currVal CacheSentinel, newVal CacheSentinel) bool
CanSetSentinelGivenCurrVal 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, refresh 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