2017 © Pedro Peláez
 

library fcache

Driver file cache, separation key-folder, Laravel 4 integration

image

artdevue/fcache

Driver file cache, separation key-folder, Laravel 4 integration

  • Thursday, June 26, 2014
  • by artdevue
  • Repository
  • 3 Watchers
  • 8 Stars
  • 41 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

# File cache driver - Fcache

File cache driver distrubutes cache to folders depending to key-parameter. This is Laravel 4 integration of Fcache., (*1)

Quick Start

You can install this Fcache class quickly and easily with Composer., (*2)

Edit your composer.json and add next:, (*3)

"artdevue/fcache": "dev-master"

Run Composer to install or update the new dependencies:, (*4)

$ composer update

Laravel 4 Integration

The Fcache Cache class supports Laravel 4 integration. Best practice is to add the ServiceProvider of the Intervention Fcache in Laravel 4 installment., (*5)

Open your Laravel config file config/app.php and add the following:, (*6)

In the $providers section add service providers for this package., (*7)

'Artdevue\Fcache\FcacheServiceProvider'

Open your Laravel global file start/global.php and add the following lines., (*8)

Cache::extend('fcache', function($app)
{
    $store = new Artdevue\Fcache\Fcache;
    return new Illuminate\Cache\Repository($store);
});

Usage

Open your Laravel config file config/cache.php and change driver to fcache., (*9)

'driver' => 'fcache',

Note! All commands are identical to the driver file cache, except forget, (*10)

To create a directory cache it is enough to separate the slash key directory, the file will be the last word., (*11)

For example, create the key folder/onesubfolder/onefile., (*12)

```php Cache::put('folder/onesubfolder/onefile', 'value', $minutes);, (*13)


The system automatically will create subfolders - *folder* and *onesubfolder*, and the file *onefile.cache* ```php folder onesubfolder onefile.cache twofile.cache twosubfolder onefile.cache twofile.cache file.cache

With the file cache Fcache you can delete the entire cache, and the cache folder. To delete a file folder/onesubfolder/onefile.cache, (*14)

Cache::forget('folder/onesubfolder/onefile');

If you need to remove all the files in a directory folder/onesubfolder, then change the key to folder/onesubfolder., (*15)

Cache::forget('folder/onesubfolder');

You can group your cache folders, it gives you ability to delete the whole group cache files., (*16)

Using tags

Also file driver Fcache works with Tags. When you add a cache, you can use comma-separated parameter tags. Example: ```php Cache::tags('country,all')->put('key', 'value', $minutes);, (*17)

or
 ```php
$value = Cache::tags('users,all')->rememberForever('users', function()
{
    return DB::table('users')->get();
});

Now you can easily remove any cache tag. For example, to delete the cache tag with the users: ```php Cache::forgetTags('users');, (*18)

**Note!** If you want to delete the cache with different tags, assign comma-separated tags. 
For example:
 ```php
Cache::forgetTags('users,all');

Authors

Valentin Rasulov
artdevue.com
http://artdevue.com

The Versions

26/06 2014

dev-master

9999999-dev http://github.com/artdevue/Fcache

Driver file cache, separation key-folder, Laravel 4 integration

  Sources   Download

MIT

The Requires

 

by Valentin Rasulov

laravel file cache folder