2017 © Pedro Peláez
 

library cache

A package that allows you to use two caching engines, one as a fallback for the other

image

masnun/cache

A package that allows you to use two caching engines, one as a fallback for the other

  • Sunday, October 12, 2014
  • by masnun
  • Repository
  • 1 Watchers
  • 1 Stars
  • 2 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Cache

A laravel package that allows using two caching engines, one as a fallback for the other, (*1)

Installation

Add the following to your composer.json file's require section:, (*2)

    "masnun/cache": "dev-master"

Run composer update. Composer should install the latest version of the package., (*3)

Now, register the Service Provider in app/config/app.php file. Add the following line to the providers array:, (*4)

'Masnun\Cache\CacheServiceProvider'

You should next register an alias for the API. We recommend MCache. Add the following line to the aliases array in the same file:, (*5)

'MCache'  => 'Masnun\Cache\CacheFacade',

Let's publish the configuration values for the package. Execute from the command line:, (*6)

php artisan config:publish masnun/cache

The configuration file will be published to app/config/packages/masnun/cache/cache.php. Please feel free to tweak the values. Here's a short description:, (*7)

  • primary - the name of the primary cache driver (eg. 'memcached' for memcached )
  • secondary - the name of the fallback cache driver
  • default_expiration - the default value for cache expiration
  • async - should the data be offloaded using background async queues?
  • async_driver - if yes, then using which queue driver?

(PS: The async data offloading still not implemented, it's work in progress)., (*8)

Code Sample

Route::get('/', function ()
{
    MCache::put('name', 'masnun', 60);
    return MCache::get('name');
});

Please feel free to be creative and try the usual Cache APIs. Here's a list of currently implemented methods:, (*9)

  • put()
  • add()
  • has()
  • get()
  • forever()
  • remember()
  • rememberForever()
  • pull()
  • forget()

The Versions

12/10 2014

dev-master

9999999-dev

A package that allows you to use two caching engines, one as a fallback for the other

  Sources   Download

The Requires

 

laravel cache