2017 © Pedro Peláez
 

library cache

Coercive Utility Cache

image

coercive/cache

Coercive Utility Cache

  • Thursday, March 15, 2018
  • by Coercive
  • Repository
  • 1 Watchers
  • 1 Stars
  • 574 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 24 % Grown

The README.md

Coercive Utility Cache

Simple cache helpers., (*1)

Get

composer require coercive/cache

JSON

use Coercive\Utility\Cache

# Load your cache instance for a defined project
$json = new Json('/temp/my_project_directory')

# Set a global default expire delay
$json = new Json('/temp/my_project_directory', 'P1D')
# OR
$json->setExpireDelay('P1D')

# Retrieve your data
$data = $json->get('data-key')

# Save your data
$json->set('data-key', ['data1', 'data2'])

# Save your data with specific expire delay
$json->set('data-key', ['data1', 'data2'], 'PT15M')

# Delete specific data
$json->delete('data-key')

# Empty cache
$json->clear()

# You can enable/disable the cache
$json->disable()
$json->enable()
$json->setState(bool)

# If cache disable
$json->get('data-key') => return null

PHP

use Coercive\Utility\Cache

# Load your cache instance for a defined project
$php = new Php('/temp/my_project_directory')

# Set a global default expire delay
$php = new Php('/temp/my_project_directory', 'P1D')
# OR
$php->setExpireDelay('P1D')

# Retrieve your data
$data = $php->get('data-key')

# Save your data
$php->set('data-key', ['data1', 'data2'])

# Save your data with specific expire delay
$php->set('data-key', ['data1', 'data2'], 'PT15M')

# Delete specific data
$php->delete('data-key')

# Empty cache
$php->clear()

# You can enable/disable the cache
$php->disable()
$php->enable()
$php->setState(bool)

# If cache disable
$php->get('data-key') => return null

Global

use Coercive\Utility\Cache

# Use debug method to handle exceptions
$cache->debug(function($e) {
    /** @var Exception $e */
    echo $e->getMessage();
    // do something
});

# You can also expose all exceptions
var_dump($cache->getExceptions());

The Versions

15/03 2018

dev-master

9999999-dev http://coercive.fr

Coercive Utility Cache

  Sources   Download

MIT GNU

The Requires

 

15/03 2018

0.0.7

0.0.7.0 http://coercive.fr

Coercive Utility Cache

  Sources   Download

MIT

The Requires

 

07/02 2018

0.0.6

0.0.6.0 http://coercive.fr

Coercive Utility Cache

  Sources   Download

MIT

The Requires

 

15/01 2018

0.0.5

0.0.5.0 http://coercive.fr

Coercive Utility Cache

  Sources   Download

GNU

The Requires

 

11/01 2018

0.0.4

0.0.4.0 http://coercive.fr

Coercive Utility Cache

  Sources   Download

GNU

The Requires

 

17/10 2017

0.0.3

0.0.3.0 http://coercive.fr

Coercive Utility Cache

  Sources   Download

GNU

The Requires

 

16/10 2017

0.0.2

0.0.2.0 http://coercive.fr

Coercive Utility Cache

  Sources   Download

GNU

The Requires

 

16/10 2017

0.0.1

0.0.1.0 http://coercive.fr

Coercive Utility Cache

  Sources   Download

GNU

The Requires