Download the PHP package idct/php-rapid-cache-client without Composer

On this page you can find all versions of the php package idct/php-rapid-cache-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-rapid-cache-client

IDCT Rapid Cache Client

Tests status codecov GitHub tag (latest SemVer) PHP version License

IDCT Rapid Cache Client is a high-performance Redis-backed caching library for PHP. At its core it is a clean PSR-16 (SimpleCache) implementation, so it drops straight into any framework or library that speaks the standard cache contract. On top of that baseline it adds the features real applications keep reaching for but PSR-16 leaves out: tag-based grouping and invalidation, FIFO queues, sets, sorted sets, and atomic counters - all exposed through the CacheServiceInterface contract.

The package ships two clients that share the same PSR-16 + tagging surface but differ in how values land in Redis:

Speed comes from two deliberate choices: both clients talk to Redis (or any Redis-compatible server such as Valkey) through the native ext-redis C extension, and the string client serializes values with ext-igbinary so arbitrary PHP values round-trip losslessly and cheaply. Bulk operations are pipelined and chunked, connections are established lazily and re-established transparently, and every Redis-level error is translated into a PSR-16 exception so your calling code stays backend-agnostic.

Quick example

…and the same surface as a Redis HASH when the value is a flat record and you want per-field reads / writes / atomic counters:

Features

Shared by both clients:

Specific to RapidCacheClient:

Specific to HashRapidCacheClient:

Sponsorship ❤️

This project is maintained on the side and looking for sponsors to keep the modernization moving forward. If your team relies on it, please consider chipping in - every contribution helps keep this library alive:

Sponsor on GitHub Buy Me a Coffee

Thank you to everyone who already supports the project! 🙏

Contents

Requirements

Benchmarks

The package ships with a self-benchmark that measures the throughput of both clients' operations against the same Valkey/Redis instance. There is no cross-library comparison - it answers "how many of each operation does each client sustain per second on this host". Results are grouped into six categories:

The chart is regenerated by CI and published to the assets branch:

Benchmark results

Each bar is one operation, in operations per second (higher is better), on a scale local to its category. The useful signal is the shape, not the absolute height:

Absolute numbers depend entirely on the runner hardware and the network path to Redis - treat the chart as the relative cost of single round-trips vs. pipelined work, not a guaranteed throughput figure.

Reproduce locally from the benchmark/ directory (see its README for all options):

Installation

Install the package with Composer:

Make sure the required PHP extensions are present:

Verify they are loaded:

Testing

The library ships with a PHPUnit unit suite (100% line/method coverage) and a Behat functional suite that runs against a real Valkey container. The Composer scripts start and stop the container for you via Docker Compose, so you only need Docker installed - not a local Redis.

Quality tooling:

Managing the Valkey container by hand (exposed on host port 6380):

Developing the library itself? See HUMANS.md for a full contributor guide and AGENTS.md for the rules AI agents follow.

Usage

Connecting & configuration

The simplest form takes a host, port, and optional key prefix:

For full control (authentication, database selection, timeouts, persistent connections, retry behavior, pipeline batch size) pass a RedisConnectionConfig. It is an immutable value object whose defaults are tuned for safe production behavior (a finite 1s connect timeout, non-persistent connections):

No socket is opened during construction - the connection is established lazily on the first cache operation and re-established automatically if it drops.

Basic cache operations (PSR-16)

take() - claim a value exactly once

get() then delete() leaves a window in which another client reads the same value, so two callers can both believe they claimed it. take() closes it:

EXISTS and GETDEL are issued inside one MULTI/EXEC, so the read and the removal are indivisible. EXISTS rides along purely to tell a stored literal false from a miss, the same distinction get() makes. Tag associations are cleaned up exactly as delete() does.

Under eight processes racing for one key, take() produced exactly one winner where get() plus delete() produced seven.

Use it for anything meant to be consumed once: single-use tokens, job claims, one-shot coupons, idempotency keys.

Requires Redis or Valkey 6.2+, the release that introduced GETDEL. HashRapidCacheClient offers the same method, backed by HGETALL + DEL in one transaction.

PSR-16 key rules - keys must be non-empty strings; the characters {}()/\@: are reserved and rejected with a Psr\SimpleCache\InvalidArgumentException. A TTL of 0 (or negative) deletes the entry immediately, per the spec.

Bulk operations

Multi-key operations are pipelined and automatically chunked by the configured pipelineBatchSize, keeping request size bounded on large inputs:

Tagging

Tags group related entries so you can read or invalidate them as a unit. Since PSR-16 set() does not take a tag, use setTagged() or call tag() after a plain set():

Queues

Redis lists used as FIFO queues:

enqueue() rejects null values: phpredis cannot tell a stored null apart from "queue is empty" on pop.

Sets

Unique, unordered collections:

Sorted sets

getSorted() treats a Redis sorted set as an ordered index of cache keys: it reads a window of members and resolves each member's cached value, pruning any member whose underlying key has expired. Use reversed: true for highest-score-first ordering.

Atomic counters

Backed by Redis INCRBY / DECRBY (the key is auto-created at 0):

Hash storage (HashRapidCacheClient)

Use HashRapidCacheClient when each cached value is a flat associative array of scalars (a record) and you want to read, write, or atomically modify individual fields without ever round-tripping the whole record. Each value lives in Redis as a native HASH, indexed by field name — there is no serializer involved, so wire payloads are plain Redis hash fields.

Single-field operations don't move the rest of the record across the wire:

Multi-field reads/writes:

Atomic counters operate in place on a single field, so multiple processes can hit the same counter without a read-modify-write cycle:

Tagging mirrors the string client and uses a separate index namespace (H_TAG: / H_TAGS:) so both clients can share the same Redis prefix without colliding:

What you give up vs. RapidCacheClient:

Error handling

Argument-validation problems are thrown as IDCT\Cache\Exception\InvalidArgumentException, and storage/transport failures as IDCT\Cache\Exception\CacheException. Both implement the matching PSR-16 marker interfaces, so PSR-16 consumers can catch them through the standard contract and stay backend-agnostic:

Behavior notes

Contributing

Contributions are welcome! In short:

  1. Fork the repository and create a feature branch (git checkout -b feature/your-feature).
  2. Make your change with tests and documentation. The project keeps 100% unit-test coverage, passes PHPStan level 8, follows PSR-12 + strict types, and is mutation-tested - new branches need matching tests.
  3. Run the full gate before opening a PR:

  4. Open a Pull Request against main with a clear description, and call out any breaking changes explicitly.

When reporting an issue, please include your PHP version, Redis/Valkey version, the library version, a minimal reproduction, and the full error and stack trace.

Full contributor documentation lives in HUMANS.md; the conventions AI agents must follow are in AGENTS.md.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Thank you

Thank you for using and supporting IDCT Rapid Cache Client - whether by filing issues, opening pull requests, spreading the word, or sponsoring the project. Every bit of help keeps the modernization moving and the library alive. 🙏


All versions of php-rapid-cache-client with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ext-igbinary Version *
ext-redis Version *
psr/simple-cache Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package idct/php-rapid-cache-client contains the following files

Loading the files please wait ...