View Source Cachetastic.Backend.ETS (Cachetastic v0.1.0)

ETS backend for Cachetastic.

This module implements the Cachetastic.Behaviour using ETS as the storage mechanism.

Options

  • :table_name - The name of the ETS table (default: :cachetastic)
  • :ttl - The time-to-live for cache entries in seconds (default: 600)

Examples

# Start the ETS backend
{:ok, state} = Cachetastic.Backend.ETS.start_link(table_name: :my_cache, ttl: 3600)

# Put a value in the cache
Cachetastic.Backend.ETS.put(state, "key", "value")

# Get a value from the cache
{:ok, value} = Cachetastic.Backend.ETS.get(state, "key")

# Delete a value from the cache
:ok = Cachetastic.Backend.ETS.delete(state, "key")

# Clear all values from the cache
:ok = Cachetastic.Backend.ETS.clear(state)

Summary

Functions

Clears all values from the ETS cache.

Deletes a value from the ETS cache by key.

Gets a value from the ETS cache by key.

Puts a value in the ETS cache.

Starts the ETS backend with the given options.

Functions

Clears all values from the ETS cache.

Deletes a value from the ETS cache by key.

Gets a value from the ETS cache by key.

Link to this function

put(state, key, value, ttl \\ nil)

View Source

Puts a value in the ETS cache.

Starts the ETS backend with the given options.