Search by

kinetis / cache-redis

aln-1

PSR-16 SimpleCache for Kinetis, backed by Redis (single-node or Cluster) over kinetis/redis — non-blocking, Revolt-native, with TLS support.

Package info

github.com/kinetis-dev/cache-redis

pkg:composer/kinetis/cache-redis

Statistics

Installs: 59

Dependents: 3

Suggesters: 2

Stars: 0

Open Issues: 0

v1.2.3 2026-09-21 04:12 UTC

This package is auto-updated.

Last update: 2026-09-21 04:27:10 UTC


README

Kinetis

kinetis/cache-redis
Redis-backed PSR-16 SimpleCache for Kinetis

Packagist Version Packagist Downloads PHP Version License CI

Part of Kinetis, a non-blocking PHP framework for API-first applications, developed in the kinetis-dev/kinetis monorepo.

Psr\SimpleCache\CacheInterface over kinetis/redis — non-blocking, Revolt-native, single-node or Cluster, with TLS support. This is the concrete Redis implementation Kinetis\SimpleCache (in kinetis/framework itself) leaves as an optional add-on: NullSimpleCache ships in core so the interface always has something bound, and this package supplies the real thing once you actually want it.

use Kinetis\SimpleCache\RedisSimpleCache;

$cache = RedisSimpleCache::fromConfig($config); // REDIS_URL or REDIS_HOST
$cache->set('key', 'value', ttl: 60);

Kinetis\Container\AppScope::boot() picks this up automatically once installed — REDIS_CLUSTER=true + REDIS_CLUSTER_SEEDS, or REDIS_URL/REDIS_HOST alone, binds RedisSimpleCache; none of them set binds NullSimpleCache — with zero application code required either way. Configuring Redis (REDIS_HOST/ REDIS_CLUSTER) without this package installed is a clear, immediate error naming the package to install, not a silent fallback to NullSimpleCache.

Redis transport and serialization failures arrive as Kinetis\SimpleCache\Exception\CacheException, which implements Psr\SimpleCache\CacheException and names the operation, never the key. A value the serializer cannot encode, and a stored value it cannot decode, are failures like any other: get() reports one rather than returning a miss or the default, and leaves the entry where it is.

Configuration

Read from the environment (or .env) via Kinetis\Config. Every key is scoped. With none of REDIS_URL/REDIS_HOST/REDIS_CLUSTER set, Redis is simply off and CacheInterface binds to NullSimpleCache.

Key Default Purpose
REDIS_URL Full redis:// URI; wins over the discrete keys.
REDIS_HOST Server host.
REDIS_PORT 6379 Port.
REDIS_PASSWORD Password.
REDIS_DATABASE 0 Database index (single-node only; Cluster has no SELECT).
REDIS_TIMEOUT 5 Operation budget, seconds — connect, reply, and cluster redirects together.
REDIS_TLS false Connect over TLS.
REDIS_TLS_VERIFY_PEER true Verify the server certificate.
REDIS_TLS_CA_FILE CA certificate for verification.
REDIS_CLUSTER false Use Redis Cluster mode.
REDIS_CLUSTER_SEEDS Comma-separated seed nodes for Cluster bootstrap — host:port, or [ipv6-address]:port for an IPv6 node.
REDIS_CACHE_NAMESPACE default Key namespace this cache owns; keys are stored as kinetis_cache:<namespace>:<key>.

Scoped keys follow the named-connection convention — the connection name inserts after the first segment: REDIS_HOST + cache2REDIS_CACHE2_HOST. Full reference across every package: kinetis.dev/docs/config.html.

Installation

composer require kinetis/cache-redis

Requires PHP 8.4+, kinetis/framework, and kinetis/redis. Full documentation: kinetis.dev/docs/redis.html (this runtime cache, its configuration, and the transport underneath). It is unrelated to kinetis.dev/docs/caching.html, which covers Kinetis's build-time compiled artifact.

License

MIT — see LICENSE.