2017 © Pedro Peláez
 

library static-cache

PHP simple static cache class

image

gregoriohc/static-cache

PHP simple static cache class

  • Sunday, February 4, 2018
  • by gregoriohc
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

static-cache

Latest Version on Packagist ![Software License][ico-license] Build Status ![Coverage Status][ico-scrutinizer] Quality Score ![Total Downloads][ico-downloads], (*1)

PHP simple static cache class, (*2)

Install

Via Composer, (*3)

``` bash $ composer require gregoriohc/static-cache, (*4)


## Usage ### Checking for item existence ``` php if (Cache::has('key')) { // ... }

Storing item

``` php Cache::set('key', 'value');, (*5)


### Retrieving item ``` php $value = Cache::get('key');

If you wish, you may pass a second argument to the get method specifying the default value you wish to be returned if the item doesn't exist:, (*6)

``` php $value = Cache::get('key', 'default');, (*7)


You may even pass a `Closure` as the default value. The result of the `Closure` will be returned if the specified item does not exist in the cache: ``` php Cache::get('key', function() { return 'value'; });

Retrieve and store item

Sometimes you may wish to retrieve an item from the cache, but also store a default value if the requested item doesn't exist. You may do this using the remember method:, (*8)

``` php Cache::remember('key', function() { return 'value'; });, (*9)


If the item does not exist in the cache, the Closure passed to the remember method will be executed and its result will be placed in the cache. ### Removing item ``` php Cache::forget('key');

Testing

bash $ composer test, (*10)

Change log

Please see CHANGELOG for more information on what has changed recently., (*11)

Contributing

Please see CONTRIBUTING for details., (*12)

Security

If you discover any security related issues, please email gregoriohc@gmail.com instead of using the issue tracker., (*13)

Socialware

You're free to use this package, but if it makes it to your production environment I highly appreciate you sharing it on any social network., (*14)

Credits

License

The MIT License (MIT). Please see License File for more information., (*15)

The Versions

04/02 2018

dev-master

9999999-dev https://github.com/gregoriohc/static-cache

PHP simple static cache class

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

The Development Requires

static-cache gregoriohc

04/02 2018

v1.0.0

1.0.0.0 https://github.com/gregoriohc/static-cache

PHP simple static cache class

  Sources   Download

MIT

The Requires

  • php ~5.6|~7.0

 

The Development Requires

static-cache gregoriohc