2017 © Pedro Peláez
 

library godam

Simple PSR-6/PSR-16 cache implementations >= PHP 5.3.

image

vaibhavpandeyvpz/godam

Simple PSR-6/PSR-16 cache implementations >= PHP 5.3.

  • Thursday, January 26, 2017
  • by vaibhavpandeyvpz
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

vaibhavpandeyvpz/godam

Simple PSR-6/PSR-16 cache implementations PHP >= 5.3., (*1)

Godam: गोदाम (Warehouse), (*2)

Build status ![Code Coverage][code-coverage-image] ![Latest Version][latest-version-image] ![Downloads][downloads-image] ![PHP Version][php-version-image] ![License][license-image], (*3)

SensioLabsInsight, (*4)

Install

composer require vaibhavpandeyvpz/godam

Usage

<?php

/**
 * @desc Create an instance of Godam\StoreInterface
 */
$store = new Godam\Store\MemoryStore();
// Or
$store = new Godam\Store\FileSystemStore(__DIR__ . '/cache');
// Or
$memcache = new Memcache();
$memcache->connect('localhost', 11211);
$store = new Godam\Store\MemcacheStore($memcache);
// Or
$redis = new Predis\Client('tcp://127.0.0.1:6379');
$store = new Godam\Store\PredisStore($redis);
// Or
$redis = new Redis();
$redis->connect('localhost', 6379);
$store = new Godam\Store\RedisStore($redis);

/*
 * @desc Using the simpler, PSR-16 cache
 */
$cache = new Godam\Cache($store);
$cache->set('somekey', 'somevalue', 3600 /** ttl in second(s), can be null */);
$value = $cache->get('somekey');
$cache->delete('somekey');

/*
 * @desc Or the older, PSR-6 item pool
 */
$cache = new Godam\CacheItemPool($store);
$item = $cache->getItem('somekey');
if ($item->isHit()) {
    $value = $item->get();
} else {
    $item->set('somevalue');
    $cache->save($item);
}
$cache->deleteItem('somekey');

License

See LICENSE.md file., (*5)

The Versions

26/01 2017

dev-master

9999999-dev http://vaibhavpandeyvpz.github.io/godam

Simple PSR-6/PSR-16 cache implementations >= PHP 5.3.

  Sources   Download

MIT

The Requires

 

The Development Requires

cache psr-6 psr-16

26/01 2017

1.0

1.0.0.0 http://vaibhavpandeyvpz.github.io/godam

Simple PSR-6/PSR-16 cache implementations >= PHP 5.3.

  Sources   Download

MIT

The Requires

 

The Development Requires

cache psr-6 psr-16