Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateApiKeyExpiry ¶ added in v1.25.0
func ValidateApiKeyExpiry(in ExpiresIn) momentoerrors.MomentoSvcErr
func ValidateDisposableTokenExpiry ¶ added in v1.14.0
func ValidateDisposableTokenExpiry(in ExpiresIn) momentoerrors.MomentoSvcErr
func ValidateName ¶ added in v1.20.0
Types ¶
type CollectionTtl ¶ added in v0.11.0
type CollectionTtl struct {
// Ttl is the time.Duration after which the cached collection should be expired from the cache.
// If CollectionTtl is not provided, the default Ttl that was passed to a momento.CacheClient instance is used.
Ttl time.Duration
// If RefreshTtl is true, then the collection's Ttl will be refreshed (to prolong the life of the collection) on every update.
// If false, then the collection's Ttl will only be set when the collection is initially created.
RefreshTtl bool
}
CollectionTtl represents the desired behavior for managing the Ttl on collection objects (dictionaries, lists, sets, and sorted sets) in your cache. For cache operations that modify a collection, there are a few things to consider. The first time the collection is created, we need to set a Ttl on it. For subsequent operations that modify the collection you may choose to update the Ttl in order to prolong the life of the cached collection object, or you may choose to leave the Ttl unmodified in order to ensure that the collection expires at the original TTL. The default behavior is to refresh the Ttl (to prolong the life of the collection) each time it is written. This behavior can be modified by calling WithNoRefreshTtlOnUpdates.
func FromCacheTtl ¶
func FromCacheTtl() CollectionTtl
FromCacheTtl is the default way to handle Ttls for collections. The default Ttl that was specified when constructing momento.CacheClient will be used, and the Ttl for the collection will be refreshed any time the collection is modified.
func Of ¶
func Of(ttl time.Duration) CollectionTtl
Of constructs a CollectionTtl with the specified time.Duration. Ttl for the collection will be refreshed any time the collection is modified.
func RefreshTtlIfProvided ¶
func RefreshTtlIfProvided(ttl ...time.Duration) CollectionTtl
RefreshTtlIfProvided constructs a CollectionTtl with the specified time.Duration. Will only refresh if the Ttl is provided.
func WithNoRefreshTtlOnUpdates ¶
func WithNoRefreshTtlOnUpdates(currentTtl CollectionTtl) CollectionTtl
WithNoRefreshTtlOnUpdates specifies that the TTL for the collection should not be refreshed when the collection is modified. Use this if you want to ensure that your collection expires at the originally specified time, even if you make modifications to the value of the collection.
func WithRefreshTtlOnUpdates ¶
func WithRefreshTtlOnUpdates(currentTtl CollectionTtl) CollectionTtl
WithRefreshTtlOnUpdates specifies that the TTL for the collection should be refreshed when the collection is modified. (This is the default behavior.)
type Expiration ¶ added in v1.14.0
type Expiration interface {
DoesExpire() bool
}
type ExpiresAt ¶ added in v1.25.0
type ExpiresAt struct {
// contains filtered or unexported fields
}
ExpiresAt is used in AuthClient responses to specify the expiration time of a disposable token or API key.
func ExpiresAtFromEpoch ¶ added in v1.25.0
ExpiresAtFromEpoch constructs an ExpiresAt with the specified epoch timestamp, but if timestamp is undefined, the epoch timestamp will be set to math.MaxInt64.
func (ExpiresAt) DoesExpire ¶ added in v1.25.0
type ExpiresIn ¶ added in v1.14.0
type ExpiresIn struct {
// contains filtered or unexported fields
}
ExpiresIn is used in AuthClient requests to specify the expiration time of a disposable token or API key.
func ExpiresAtEpoch ¶ added in v1.14.0
func ExpiresInDays ¶ added in v1.14.0
func ExpiresInHours ¶ added in v1.14.0
func ExpiresInMinutes ¶ added in v1.14.0
func ExpiresInNever ¶ added in v1.14.0
func ExpiresInNever() ExpiresIn