keyttl

package
v1.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package keyttl applies the TTL of a pulse Redis key inside the Lua script that writes the key, so the write and its expiry are one atomic step.

A fixed TTL is set only when the key has no TTL, the semantics of `EXPIRE key seconds NX`. A sliding TTL is reset by every write.

Index

Constants

View Source
const LuaApply = `` /* 257-byte string literal not displayed */

LuaApply is Lua source that defines the local function apply_ttl(key, seconds, sliding). Prepend it to a script. The function sets the TTL of key to seconds when seconds is positive and either sliding is "1" or key has no TTL. It does nothing when key does not exist. Pass seconds and sliding as script arguments built by Args.

Variables

This section is empty.

Functions

func Args

func Args(ttl time.Duration, sliding bool) (seconds int64, slidingArg string)

Args returns the seconds and sliding arguments of apply_ttl for ttl. A TTL below one second rounds up to one second, as the go-redis Expire command does. A zero or negative ttl disables the expiry.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL