keystore

Types

pub opaque type Keystore
pub type StoreEntry {
  StoreEntry(
    value: String,
    ttl: option.Option(timestamp.Timestamp),
  )
}

Constructors

Values

pub fn delete(store: Keystore, key: String) -> Keystore

Manually delete an entry from the store

pub fn expire(
  store: Keystore,
  key: String,
  seconds: Int,
) -> Keystore

Add an expiration to an entry, this will make the value unaccessible when expired. An aditional cleanup function tidy is given to remove expired entries.

pub fn get(store: Keystore, key: String) -> option.Option(String)

Get the value of a key

pub fn new() -> Keystore
pub fn set(
  store: Keystore,
  key: String,
  value: String,
) -> Keystore

Add an entry with a value

pub fn set_with_expiry(
  store: Keystore,
  key: String,
  value: String,
  seconds: Int,
) -> Keystore

Add an entry with a value and expiry time in one

pub fn tidy(store: Keystore) -> Keystore

Remove entries which have expired

Search Document