Introduction
Last updated
Last updated
Butterfly uses multi-layer cache management. It's possible to use multiple caches at the same time. You can configure multiple caches and use it. Butterfly uses APC as the primary cache for the configuration files.
Default cache driver is registry on application cycle but you can use the following cache drivers:
Redis
Memcached
Apc
Database
When you check Redis and other cache implementations you will see that it's written to make developer comfortable whether you are using Redis or Memcached. We have built a system with same behaviours independent from which driver you use.
Butterfly Cache Implementation usages are similar to Butterfly Database implementation.
The cache configurations are stored in app/config/cache.php
. Configurations can be customized by domain name with subfolders.
Before enable redis cache, please check installed.
Example configuration:
Database cache needs to database_cache
table. You can use following migration to create the table.
Example configuration for database:
Sample usage for the configuration:
Example configuration for memcached:
Sample usage for the configuration:
Example configuration for apc:
Sample usage for the configuration:
Cache client can be reached using cache()
helper. You can also reach defined cache drivers using the cache alias as the first parameter.
Following function call will return a cache client connected to cache external defined in configuration.
Increment cached values with optional step amount.
Decrement cached values with optional step amount.
To clear all cache, use flush method to flush related cache source.
[!TIP] Further information for parameters and options, please read documentation
Before enable memcached cache, please check installed and enabled.
Before enable apc cache, please check installed and enabled.