Skip to content

A High speed , PSR-16 compatible cache library based on swoole-tables

License

Notifications You must be signed in to change notification settings

scrawler-labs/swoole-cache

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swoole Cache

🚀 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.