PHPackages                             krisanalfa/bono-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. krisanalfa/bono-cache

ActiveLibrary[Caching](/categories/caching)

krisanalfa/bono-cache
=====================

Laravel cache manager for Bono PHP Framework

0.1.0(12y ago)1181MITPHP

Since Mar 11Pushed 11y agoCompare

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

READMEChangelogDependencies (3)Versions (6)Used By (0)

\#BonoCache Laravel Cache for Bono PHP Framework.

\##Configuration Add these lines to your configuration file.

```
'bono.providers' => array(
    '\\KrisanAlfa\\Cache\\Provider\\CacheProvider'
),

'cache' => array(
    'driver' => 'file',
    'path' => __DIR__ . '/../../cache',
    'prefix' => 'bono',
)
```

The configuration takes three settings, they are `driver`, `path`, and `prefix`.

\####Driver This option controls the default cache "driver" that will be used when using the Caching library. Of course, you may use other drivers any time you wish.

**Supported Driver:**

- Now : `file`, `array`, `apc`
- Later: `norm`, `redis`, `memcached`

\####Path When using the `file` cache driver, we need an absolute location where the cache files may be stored.

\##Cache Usage

#### Storing An Item In The Cache

[](#storing-an-item-in-the-cache)

```
$app->cache->put('key', 'value', $minutes);
```

#### Using Carbon Objects To Set Expire Time

[](#using-carbon-objects-to-set-expire-time)

```
$expiresAt = Carbon::now()->addMinutes(10);

$app->cache->put('key', 'value', $expiresAt); // cache will be expired at 10 minutes later
```

#### Storing An Item In The Cache If It Doesn't Exist

[](#storing-an-item-in-the-cache-if-it-doesnt-exist)

```
$app->cache->add('key', 'value', $minutes);
```

The `add` method will return `true` if the item is actually **added** to the cache. Otherwise, the method will return `false`.

#### Checking For Existence In Cache

[](#checking-for-existence-in-cache)

```
if ($app->cache->has('key'))
{
    //
}
```

#### Retrieving An Item From The Cache

[](#retrieving-an-item-from-the-cache)

```
$value = $app->cache->get('key');
```

#### Retrieving An Item Or Returning A Default Value

[](#retrieving-an-item-or-returning-a-default-value)

```
$value = $app->cache->get('key', 'default');

$value = $app->cache->get('key', function() { return 'default'; });
```

#### Storing An Item In The Cache Permanently

[](#storing-an-item-in-the-cache-permanently)

```
$app->cache->forever('key', 'value');
```

Sometimes you may wish to retrieve an item from the cache, but also store a default value if the requested item doesn't exist. You may do this using the `$app->cache->remember` method:

```
$value = $app->cache->remember('users', $minutes, function()
{
    return Norm::factory('User')->find();
});
```

You may also combine the `remember` and `forever` methods:

```
$value = $app->cache->rememberForever('users', function()
{
    return Norm::factory('User')->find();
});
```

Note that all items stored in the cache are serialized, so you are free to store any type of data.

#### Removing An Item From The Cache

[](#removing-an-item-from-the-cache)

```
$app->cache->forget('key');
```

Cache Tags
----------

[](#cache-tags)

> **Note:** Cache tags are not supported when using the `file` cache drivers. Furthermore, when using multiple tags with caches that are stored "forever", performance will be best with a driver such as `memcached`, which automatically purges stale records.

Cache tags allow you to tag related items in the cache, and then flush all caches tagged with a given name. To access a tagged cache, use the `tags` method:

#### Accessing A Tagged Cache

[](#accessing-a-tagged-cache)

You may store a tagged cache by passing in an ordered list of tag names as arguments, or as an ordered array of tag names.

```
$app->cache->tags('people', 'authors')->put('Alfa', $alfa, $minutes);

$app->cache->tags(array('people', 'artists'))->put('Ganesha', $ganesha, $minutes);
```

You may use any cache storage method in combination with tags, including `remember`, `forever`, and `rememberForever`. You may also access cached items from the tagged cache, as well as use the other cache methods such as `increment` and `decrement`:

#### Accessing Items In A Tagged Cache

[](#accessing-items-in-a-tagged-cache)

To access a tagged cache, pass the same ordered list of tags used to save it.

```
$ganesha = $app->cache->tags('people', 'artists')->get('Ganesha');

$alfa = $app->cache->tags(array('people', 'authors'))->get('Alfa');
```

You may flush all items tagged with a name or list of names. For example, this statement would remove all caches tagged with either `people`, `authors`, or both. So, both "Ganesha" and "Alfa" would be removed from the cache:

```
$app->cache->tags('people', 'authors')->flush();
```

In contrast, this statement would remove only caches tagged with `authors`, so "Alfa" would be removed, but not "Ganesha".

```
$app->cache->tags('authors')->flush();
```

\##Read More For more information about Laravel Cache, read [this](http://laravel.com/api/4.1/Illuminate/Cache/Repository.html).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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 ~6 days

Total

5

Last Release

4422d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5585ab7e83e92b16ebfde64d7d90ff330721bcb1fbfa193fb0ffe149a4b3a7d1?d=identicon)[krisanalfa](/maintainers/krisanalfa)

---

Top Contributors

[![krisanalfa](https://avatars.githubusercontent.com/u/3734729?v=4)](https://github.com/krisanalfa "krisanalfa (7 commits)")[![reekoheek](https://avatars.githubusercontent.com/u/299394?v=4)](https://github.com/reekoheek "reekoheek (2 commits)")

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.8M26](/packages/genealabs-laravel-model-caching)[mikebronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k127.1k1](/packages/mikebronner-laravel-model-caching)[silber/page-cache

Caches responses as static files on disk for lightning fast page loads.

1.3k441.9k6](/packages/silber-page-cache)[laragear/cache-query

Remember your query results using only one method. Yes, only one.

272122.8k](/packages/laragear-cache-query)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

2057.2k](/packages/iazaran-smart-cache)

PHPackages © 2026

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