PHPackages                             pllano/cache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. pllano/cache

ActiveLibrary[Caching](/categories/caching)

pllano/cache
============

Caching for API Shop

1.0.2(8y ago)09MITPHPPHP &gt;=5.4.0

Since Feb 5Pushed 8y ago1 watchersCompare

[ Source](https://github.com/pllano/cache)[ Packagist](https://packagist.org/packages/pllano/cache)[ Docs](https://github.com/pllano/cache)[ RSS](/packages/pllano-cache/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

Кеширование для вашего проекта
==============================

[](#кеширование-для-вашего-проекта)

Демо и тесты
------------

[](#демо-и-тесты)

- Демо -
- Тест скорости -

Поддерживаемые типы кеша
------------------------

[](#поддерживаемые-типы-кеша)

- `memcached` - стабильно
- `memcache` - стабильно
- `filesystem` - стабильно
- `json` - стабильно
- `predis` - стабильно
- `redis` - стабильно
- `mongodb` - стабильно
- `elasticsearch` - в разработке
- `apcu` - дорабатывается (обнаружены ошибки в `cache/cache`)
- `apc` - дорабатывается (обнаружены ошибки в `cache/cache`)
- `array` - дорабатывается
- `illuminate` - дорабатывается
- `doctrine` - дорабатывается

Конфигурация
------------

[](#конфигурация)

Передать конфигурацию можно двумя способами:

- Из фала [`cache_config.json`](https://github.com/pllano/cache/blob/master/src/cache_config.json)
- Массивом в конструктор `$config = [];`

Использование
-------------

[](#использование)

```
use Pllano\Caching\Cache;

// Передать конфигурацию в конструктор
// Если передать пустой массив [] возмет конфигурацию из файла cache_config.json
$cache_config = [];
$key = 'site/index'; // Передать url или ключ без кодирования
// $key = 'https://example.com/to/patch?param=data/lang=ru'; // При мультиязычности рекомендуется добавлять язык
$cache_lifetime = 30*24*60*60; // Установить время жизни кеша. в примере установлено 30 дней.

// Подключить класс
$cache = new Cache($cache_config);
// Установить путь к файлу конфигурации
// $path = __DIR__ . '/../configs/';
// $cache->set_config($path);
// Проверяем статус кеширования и наличие кеша
if ($cache->run($key, $cache_lifetime) === null) {
    // Контент для сохранения передается в виде массива
    $content = []; // Получаем массив данных из базы
    // Если кеширование включено сохраняем кеш
    if ((int)$cache->state() == 1) {
        $cache->set($content, $key);
    }
} else {
    // Если кеширование включено и кеш существует вернет массив данных из кеша
    $content = $cache->get($key);
}
```

### Передать html код

[](#передать-html-код)

```
// $cache->run_html();
// $cache->set_html();
// $cache->get_html();

if ($cache->run_html($key, $cache_lifetime) === null) {
    if ((int)$cache->state() == 1) {
        $cache->set_html($content, $key);
    }
} else {
    $content = $cache->get_html($key);
}
```

Установка
---------

[](#установка)

### Подключить с помощью Composer

[](#подключить-с-помощью-composer)

```
"require" {
    ...
-    "pllano/cache": "1.0.1",
+    "pllano/cache": "1.0.2",
    ...
}
```

### Подключить с помощью [AutoRequire](https://github.com/pllano/auto-require)

[](#подключить-с-помощью-autorequire)

```
{
  "require": [{
    "namespace": "Pllano\\Caching",
      "dir": "/pllano/cache/src",
      "link": "https://github.com/pllano/cache/archive/master.zip",
      "git": "https://github.com/pllano/cache",
      "name": "cache",
      "version": "master",
      "vendor": "pllano",
      "state": "1",
      "system_package": "1"
    }, {
      "namespace": "Cache",
      "dir": "/cache/cache/src",
      "link": "https://github.com/php-cache/cache/archive/1.0.0.zip",
      "git": "https://github.com/php-cache/cache",
      "name": "cache",
      "version": "1.0.0",
      "vendor": "cache",
      "state": "1",
      "system_package": "0"
    }, {
      "namespace": "Predis",
      "dir": "/predis/predis/src",
      "link": "https://github.com/nrk/predis/archive/v1.1.1.zip",
      "git": "https://github.com/nrk/predis",
      "name": "predis",
      "version": "1.1.1",
      "vendor": "predis",
      "state": "1",
      "system_package": "0"
    }, {
      "namespace": "League\\Flysystem",
      "dir": "/league/flysystem/src",
      "link": "https://github.com/thephpleague/flysystem/archive/1.0.42.zip",
      "git": "https://github.com/thephpleague/flysystem",
      "name": "flysystem",
      "version": "1.0.42",
      "vendor": "league",
      "state": "1",
      "system_package": "0"
  }, {
      "namespace": "Psr\\SimpleCache",
      "dir": "/psr/simple-cache/src",
      "link": "https://github.com/php-fig/simple-cache/archive/1.0.0.zip",
      "git": "https://github.com/php-fig/simple-cache",
      "name": "simple-cache",
      "version": "1.0.0",
      "vendor": "psr",
      "state": "1",
      "system_package": "1"
    }, {
      "namespace": "Psr\\Log",
      "dir": "/psr/log/Psr/Log",
      "link": "https://github.com/php-fig/log/archive/1.0.2.zip",
      "git": "https://github.com/php-fig/log",
      "name": "log",
      "version": "1.0.2",
      "vendor": "psr",
      "state": "1",
      "system_package": "1"
    }, {
      "namespace": "Doctrine\\Common\\Cache",
      "dir": "/doctrine/cache/lib/Doctrine/Common/Cache",
      "link": "https://github.com/doctrine/cache/archive/v1.6.2.zip",
      "git": "https://github.com/doctrine/cache",
      "name": "cache",
      "version": "1.6.2",
      "vendor": "doctrine",
      "state": "1",
      "system_package": "1"
    }
  ]
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

2

Last Release

3017d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/83c4d844db99c883895755ca0e1dab41ba50f6e9faedbb972c2d35230a7dc0c2?d=identicon)[joomimart](/maintainers/joomimart)

---

Top Contributors

[![ruslan-avantis](https://avatars.githubusercontent.com/u/16430046?v=4)](https://github.com/ruslan-avantis "ruslan-avantis (47 commits)")

---

Tags

cachecaching

### Embed Badge

![Health badge](/badges/pllano-cache/health.svg)

```
[![Health](https://phpackages.com/badges/pllano-cache/health.svg)](https://phpackages.com/packages/pllano-cache)
```

###  Alternatives

[psr/simple-cache

Common interfaces for simple caching

8.1k727.3M2.1k](/packages/psr-simple-cache)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[tedivm/stash

The place to keep your cache.

9824.8M124](/packages/tedivm-stash)[spatie/blink

Cache that expires in the blink of an eye

1685.0M8](/packages/spatie-blink)[gregwar/cache

A lightweight file-system cache system

1084.5M22](/packages/gregwar-cache)[putyourlightson/craft-blitz

Intelligent static page caching for creating lightning-fast sites.

153471.5k29](/packages/putyourlightson-craft-blitz)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
