PHPackages                             mabslabs/casper-cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. mabslabs/casper-cache

ActiveProject[Caching](/categories/caching)

mabslabs/casper-cache
=====================

In-memory key/value cache server

v1.0.0(1y ago)02MITPHPPHP &gt;=8.1

Since Jan 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/kernel64/casper-cache)[ Packagist](https://packagist.org/packages/mabslabs/casper-cache)[ RSS](/packages/mabslabs-casper-cache/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Casper Cache - A PHP Cache Server
=================================

[](#casper-cache---a-php-cache-server)

A simple in-memory cache server written in PHP that supports `SET`, `GET`, `DEL`, and `ALL` commands via TCP connections. This project allows clients to connect to the server and store key-value pairs in memory, with optional TTL (Time-To-Live) for each entry.

Features
--------

[](#features)

- Supports `SET`, `GET`, `DEL`, and `ALL` commands.
- Cache values can be stored with optional TTL (default 30 minutes).
- Simple key-value storage in memory with automatic cleanup when TTL expires.
- Supports different data types for values (e.g., strings, integers, arrays, etc.).

Requirements
------------

[](#requirements)

- PHP 8.1 or higher.
- A TCP client capable of sending JSON-based requests.

Installation
------------

[](#installation)

1. **Clone this repository:**

    ```
    git clone https://github.com/kernel64/casper-cache.git
    cd casper-cache
    ```
2. **Install the dependencies:**This project does not require any additional dependencies. (for the moment)
3. **Start the cache server:**

    Run the `server` script:

    ```
    php run.php
    ```

    The server will start listening on `127.0.0.1:100824` by default. Adjust the address and port as needed.

---

Example of use
--------------

[](#example-of-use)

1. \*\* Using CacheClient.php:\*\*

    A client that connects to the Casper Cache server and sends requests.

    ```
