PHPackages                             hail/optimize - 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. [Framework](/categories/framework)
4. /
5. hail/optimize

ActiveLibrary[Framework](/categories/framework)

hail/optimize
=============

Use memory expansion to reduce file system IO

v0.10.0(4y ago)0111MITPHPPHP &gt;=8.0.0

Since May 6Pushed 4y ago1 watchersCompare

[ Source](https://github.com/hail-framework/optimize)[ Packagist](https://packagist.org/packages/hail/optimize)[ Docs](http://framework.flyinghail.com/)[ RSS](/packages/hail-optimize/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (7)DependenciesVersions (8)Used By (1)

Hail Optimize
=============

[](#hail-optimize)

Use the memory extension cache:

- data storage in files, reduce file system IO
- data after complex operations

Environment Variables
=====================

[](#environment-variables)

- HAIL\_OPTIMIZE\_ADAPTER
    - auto (default)
        - check order: yac, apcu, wincache, redis
    - yac
        - yac extension must be installed
    - apcu
        - apcu extension must be installed
    - wincache
        - wincache extension must be installed
    - redis
        - phpredis extension must be installed
        - HAIL\_OPTIMIZE\_REDIS must be defined
    - memory
        - saving data with PHP arrays
    - none
        - disable
- HAIL\_OPTIMIZE\_DELAY
    - The time interval between checking whether the cached file changes (seconds)
    - 0 means check every time you get data
    - Less than 0 means never check (not recommended)
    - if not defined, the default value is 5
- HAIL\_OPTIMIZE\_REDIS
    - redis configuration
    - unix:///var/run/redis/redis.sock?auth=password&amp;select=0
    - tcp://127.0.0.1:6379?auth=password&amp;select=0

Example
=======

[](#example)

```
use Hail\Optimize\OptimizeTrait;

class Example
{
    use OptimizeTrait;

    private string $folder;

    public function __construct(string $folder)
    {
        $this->folder = $folder;
    }

    public function dataReader(string $file): array
    {
        return unserialize(file_get_contents($file));
    }

    public function get(string $name): array
    {
        $file = $this->folder . DIRECTORY_SEPARATOR . $name . '.json';
        return $this->optimize()->load($file);
    }

    public function getSerializeData($name): array
    {
        $file = $this->folder . DIRECTORY_SEPARATOR . $name . '.data';

        return $this->optimize()->load($file, [$this, 'dataReader']);
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

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 ~137 days

Recently: every ~185 days

Total

7

Last Release

1744d ago

PHP version history (2 changes)v0.8.0PHP &gt;=7.1.3

v0.10.0PHP &gt;=8.0.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/157430?v=4)[FENG Hao](/maintainers/flyinghail)[@flyinghail](https://github.com/flyinghail)

---

Top Contributors

[![flyinghail](https://avatars.githubusercontent.com/u/157430?v=4)](https://github.com/flyinghail "flyinghail (17 commits)")

---

Tags

frameworkrediscacheapcuwincacheoptimizeHailyac

### Embed Badge

![Health badge](/badges/hail-optimize/health.svg)

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

###  Alternatives

[phpfastcache/phpfastcache

PHP Abstract Cache Class - Reduce your database call using cache system. Phpfastcache handles a lot of drivers such as Apc(u), Cassandra, CouchBase, Couchdb, Dynamodb, Firestore, Mongodb, Files, (P)redis, Leveldb, Memcache(d), Ravendb, Ssdb, Sqlite, Wincache, Xcache, Zend Data Cache.

2.4k5.0M130](/packages/phpfastcache-phpfastcache)[kohana/cache

The official Kohana cache management module

76318.3k8](/packages/kohana-cache)[utopia-php/cache

A simple cache library to manage application cache storing, loading and purging

31379.3k8](/packages/utopia-php-cache)[yiisoft/cache-redis

Yii Caching Library - Redis Handler

1012.9k](/packages/yiisoft-cache-redis)[yiisoft/cache-apcu

Yii Caching Library - APCu Handler

136.5k](/packages/yiisoft-cache-apcu)

PHPackages © 2026

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