2017 © Pedro Peláez
 

library cachix

A simple PHP Caching Class working with files

image

gueff/cachix

A simple PHP Caching Class working with files

  • Thursday, February 8, 2018
  • by gueff
  • Repository
  • 1 Watchers
  • 3 Stars
  • 960 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Cachix

A simple PHP Caching Class working with files, (*1)

Requirements

  • PHP >= 7.4
  • Linux commands rm, find and grep to be executable via PHP's shell_exec command

Installation

create the composer.json file with following content:, (*2)

{
    "require": {
        "gueff/cachix":"1.0.2"
    }
}

run installation, (*3)

$ composer install

Usage

<?php

// init Config
\Cachix::init(array(
    'bCaching' => true,
    'sCacheDir' => '/tmp/',
    'iDeleteAfterMinutes' => 10,
    'sBinRemove' => '/bin/rm',
    'sBinFind' => '/usr/bin/find',
    'sBinGrep' => '/bin/grep'
));

// build a Cache-Key
$sKey = 'myCacheKey.Token';

// autodelete cachefiles
// which contain the string ".Token" in key-names
\Cachix::autoDeleteCache('.Token');

// first time saving data to cache...
if (empty(\Cachix::getCache($sKey)))
{
    // Data to be cached
    $aData = ['foo' => 'bar'];

    \Cachix::saveCache(
        $sKey,
        $aData
    );
}
// ...or read from existing Cache
else
{
    $aData = \Cachix::getCache($sKey);
}

The Versions

08/02 2018

dev-master

9999999-dev https://github.com/gueff/cachix

A simple PHP Caching Class working with files

  Sources   Download

GPLv3 GPL-3.0-or-later

The Requires

  • php >=7.0

 

by Guido K.B.W. Ueffing

file cache php caching php7