maslosoft/cache

Easy to use, auto configurable, extensible cache provider

1.0.11 2017-11-19 22:25 UTC

README

Easy to use, auto configurable, extensible cache provider

Latest Stable Version License

68747470733a2f2f7472617669732d63692e6f72672f4d61736c6f736f66742f43616368652e7376673f6272616e63683d6d6173746572

687474703a2f2f6868766d2e683463632e64652f62616467652f6d61736c6f736f66742f63616368652e7376673f7374796c653d666c6174

Quick Install

composer require maslosoft/cache

######Easy to use, auto configurable, extensible cache provider

If you need some modern cache with just basic features here it is.

It implements only basic cache operations:

  • has - to check if has key in cache
  • get - to get cached value by key
  • set - to set value to cache
  • remove - to remove cached value
  • clear - to clear entira cache

Requirements

  • PHP 5.6+
  • composer

Setup

Use composer to install extension:

composer require maslosoft/cache:"*"

Setup cache. After calling init any further instance will be configured same as below $cache.

use Maslosoft\Cache\Cache;

$cache = new Cache();
// Setup something here...
$cache->timeout = 1244;
$cache->init();

Basic Usage

<?php

use Maslosoft\Cache\Cache;

$cache = new Cache();

// Init configuration, now it is available anywhere
// By default it will try some cache providers and select best available.
$cache->init();

$key = 1;

if(!$cache->has($key))
{
	$cache->set($key, 'Some value');
}

echo $cache->get($key);

And that's it!

Resources