it-tech/cache

Library for working with cache

dev-master 2019-12-15 12:57 UTC

This package is auto-updated.

Last update: 2024-09-15 23:37:51 UTC


README

Создать объект класса передав в качестве параметра путь до директории кэш

<?php

use ITTech\Lib\Cache;

$cache = new Cache(__DIR__."/tmp/cache");

/*
 * Создать кэш
 * @param $key
 * @param $data
 * @param int $time
 * @return bool
 */
$cache->set("/controller", "Привет мир!", time() * 24);

/*
 * Выбор их кэша
 * Возвращает строку или bool в случае просрочки или ошибки
 */
$cache->get("/controller");

/*
 * Удалить кэш
 */
$cache->drop("/controller");