Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

00f100/fcphp-cache

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

00f100/fcphp-cache

Cache Index for FcPhp

Source
Packagist
Version
0.2.1
Version published
Maintainers
1
Created
Source

FcPhp Cache

Package to manage Cache Index

Build Status codecov Total Downloads

How to install

Composer:

$ composer require 00f100/fcphp-cache

or add in composer.json

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

How to use

<?php

use FcPhp\Cache\Facades\CacheFacade;

/**
 * Method to create new instance of Cache
 *
 * @param array $redis Configuration of redis
 * @param string $path Path to cache in file
 * @return FcPhp\Cache\Interfaces\ICache
 */
$cache = CacheFacade::getInstance(?array $redis, string $path = null);

/*
	To use with Redis
	=========================
*/

$redis = [
	'host' => '127.0.0.1',
	'port' => '6379',
	'password' => null,
	'timeout' => 100,
];
$cache = CacheFacade::getInstance($redis, null);

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

/**
 * 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

FAQs

Package last updated on 22 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts