The PHP cache library implementing psr-16.

dev-main 2022-09-18 11:15 UTC

This package is auto-updated.

Last update: 2024-10-18 15:49:20 UTC


README

A simple cache library implementing PSR-16.

Build Status codecov Latest Stable Version PHP Version Require License Total Downloads

Install

composer require super-simple/cache

Requires PHP 8.1 or newer.

Usage

Basic usage:

<?php
require_once __DIR__ . '/../vendor/autoload.php';

use SSCache\CacheService;

$cache = (new CacheService(new YourStorage()));

// Set the value
$cache->set($key, $value, $ttl);

// Get the value
$result = $cache->get($key);

The $ttl could be int, null or \DateInterval

The storage must implement SSCache\CacheStorageInterface.

It's up to you how to handle $ttl in the storage.

For more details check out the wiki.

License

The Super Simple Cache is open-sourced software licensed under the MIT license.