scrawler/swoole-cache

High Speed in memory cahce using swoole table

v1.01 2022-05-29 13:45 UTC

This package is auto-updated.

Last update: 2024-04-15 03:44:46 UTC


README

🚀 A High speed , PSR-16 compatible cache library based on swoole-tables 🚀
🇮🇳 Made in India 🇮🇳

💻 Installation

Swoole cache requires open-swoole extension to be installed follow this guide to install open-swoole,

You can install Swoole cache via Composer. If you don't have composer installed , you can download composer from here

composer install scrawler/swoole-cache

🏁 Usage

This is a fully compatible PSR-16 cache and uses all the PSR 16 methods

include __DIR__.'/../vendor/autoload.php';

//Setup (parameter $size is optional)
$cache = new SwooleCache(10);

$key = "name";
$value = "Pranjal";

// set key value pair in in cache
$cache->set($key, $value);

// get value from key
$cache->get($key);

// delete value using key
cache->delete($key);

// Set multiples values
$datas = [
  "user_one" => "Pranjal",
  "user_two" => "Raj"     
 ];
 
$cache->setMultiple($datas);

// Set multiple values
$cache->setMultiple($datas);

// Get multiple values
$cache->getMultiple(["user_one", "user_two"])

// Clear complete cache
$cache->clear();

📄 License

Swoole Cache is created by Pranjal Pandey and released under the Apache 2.0 License.