2017 © Pedro Peláez
 

package fcphp-cache

Cache Index for FcPhp

image

00f100/fcphp-cache

Cache Index for FcPhp

  • Friday, July 13, 2018
  • by 00F100
  • Repository
  • 1 Watchers
  • 0 Stars
  • 33 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

FcPhp Cache

Package to manage Cache Index and crypto content using Sodium PHP (optional), (*1)

Build Status codecov Total Downloads, (*2)

How to install

Composer:, (*3)

$ composer require 00f100/fcphp-cache

or add in composer.json, (*4)

{
    "require": {
        "00f100/fcphp-cache": "*"
    }
}

How to use

<?php

use FcPhp\Cache\Facades\CacheFacade;
use FcPhp\Crypto\Crypto;

/**
 * Method to create new instance of Cache
 *
 * @param string|array $cacheRepository Configuration of redis or path to save files cache
 * @param string $nonce Nonce to use crypto into content of cache. To generate: \FcPhp\Crypto\Crypto::getNonce()
 * @param string $pathKeys Path to save keys crypto
 * @return FcPhp\Cache\Interfaces\ICache
 */
$cache = CacheFacade::getInstance(string|array $cacheRepository, string $nonce = null, string $pathKeys = null);

/*
    To use with Redis
    =========================
*/
$redis = [
    'host' => '127.0.0.1',
    'port' => '6379',
    'password' => null,
    'timeout' => 100,
];
$cache = CacheFacade::getInstance($redis);
/*
    To use with Redis and crypto
    =========================
*/
$redis = [
    'host' => '127.0.0.1',
    'port' => '6379',
    'password' => null,
    'timeout' => 100,
];
$cache = CacheFacade::getInstance($redis, Crypto::getNonce(), 'path/to/keys');

/*
    To use with file
    =========================
*/
$cache = CacheFacade::getInstance('path/to/cache');

/*
    To use with file and crypto
    =========================
*/
$cache = CacheFacade::getInstance('path/to/cache', Crypto::getNonce(), 'path/to/keys');

/**
 * Method to create new cache
 *
 * @param string $key Key to name cache
 * @param mixed $content Content to cache
 * @param int $ttl time to live cache
 * @return FcPhp\Cache\Interfaces\ICache
 */
$cache->set(string $key, $content, int $ttl) :ICache

/**
 * Method to verify if cache exists
 *
 * @param string $key Key to name cache
 * @return bool
 */
$cache->has(string $key) :bool

/**
 * Method to verify/read cache
 *
 * @param string $key Key to name cache
 * @return mixed
 */
$cache->get(string $key)

/**
 * Method to delete cache
 *
 * @param string $key Key to name cache
 * @return void
 */
$cache->delete(string $key) :void

/**
 * Method to clean old caches
 *
 * @return FcPhp\Cache\Interfaces\ICache
 */
$cache->clean() :ICache

The Versions

13/07 2018

dev-master

9999999-dev https://github.com/00f100/fcphp-cache

Cache Index for FcPhp

  Sources   Download

The Requires

 

The Development Requires

cache redis crypto php7 fcphp php72

13/07 2018

0.3.2

0.3.2.0 https://github.com/00f100/fcphp-cache

Cache Index for FcPhp

  Sources   Download

The Requires

 

The Development Requires

cache redis crypto php7 fcphp php72

22/06 2018

0.3.1

0.3.1.0 https://github.com/00f100/fcphp-cache

Cache Index for FcPhp

  Sources   Download

The Requires

 

The Development Requires

cache redis crypto php7 fcphp php72

22/06 2018

0.3.0

0.3.0.0 https://github.com/00f100/fcphp-cache

Cache Index for FcPhp

  Sources   Download

The Requires

 

The Development Requires

cache redis crypto php7 fcphp php72

22/06 2018

0.2.1

0.2.1.0 https://github.com/00f100/fcphp-cache

Cache Index for FcPhp

  Sources   Download

The Requires

 

The Development Requires

cache php7 fcphp

22/06 2018

0.2.0

0.2.0.0 https://github.com/00f100/fcphp-cache

Cache Index for FcPhp

  Sources   Download

The Requires

 

The Development Requires

cache php7 fcphp

21/06 2018

0.1.1

0.1.1.0 https://github.com/00f100/fcphp-cache

Cache Index for FcPhp

  Sources   Download

The Requires

 

The Development Requires

cache php7 fcphp

21/06 2018

0.1.0

0.1.0.0 https://github.com/00f100/fcphp-cache

Cache Index for FcPhp

  Sources   Download

The Requires

 

The Development Requires

cache php7 fcphp