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

Redis backend for Cachetastic.

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

Options

  • :host - The Redis host (default: "localhost")
  • :port - The Redis port (default: 6379)
  • :ttl - The time-to-live for cache entries in seconds (default: 3600)

Examples

# Start the Redis backend
{:ok, state} = Cachetastic.Backend.Redis.start_link(host: "localhost", port: 6379, ttl: 3600)

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

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

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

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

Summary

Functions

Clears all values from the Redis cache.

Deletes a value from the Redis cache by key.

Gets a value from the Redis cache by key.

Puts a value in the Redis cache.

Starts the Redis backend with the given options.

Functions

Clears all values from the Redis cache.

Deletes a value from the Redis cache by key.

Gets a value from the Redis cache by key.

Link to this function

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

View Source

Puts a value in the Redis cache.

Starts the Redis backend with the given options.