Download the PHP package krisanalfa/bono-cache without Composer
On this page you can find all versions of the php package krisanalfa/bono-cache. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download krisanalfa/bono-cache
More information about krisanalfa/bono-cache
Files in krisanalfa/bono-cache
Package bono-cache
Short Description Laravel cache manager for Bono PHP Framework
License MIT
Informations about the package bono-cache
BonoCache
Laravel Cache for Bono PHP Framework.
Configuration
Add these lines to your configuration file.
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
Using Carbon Objects To Set Expire Time
Storing An Item In The Cache If It Doesn't Exist
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
Retrieving An Item From The Cache
Retrieving An Item Or Returning A Default Value
Storing An Item In The Cache Permanently
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:
You may also combine the remember
and forever
methods:
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
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 asmemcached
, 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
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.
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
To access a tagged cache, pass the same ordered list of tags used to save it.
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:
In contrast, this statement would remove only caches tagged with authors
, so "Alfa" would be removed, but not "Ganesha".
Read More
For more information about Laravel Cache, read this.
All versions of bono-cache with dependencies
illuminate/cache Version ~4.1.23
illuminate/filesystem Version 4.1.*@dev