-
-
Notifications
You must be signed in to change notification settings - Fork 452
[V4˖] Configuration Options
Georges.L edited this page Jan 17, 2023
·
4 revisions
PhpFastCache has some options that you may want to know before using them, here's the list:
- path See the "Host/Authenticating options" section
-
default_chmod | int>octal (default: 0777)
[>=V4, <V7]
This option will define the chmod used to write driver cache files. -
defaultChmod | int>octal (default: 0777)
[>=V7]
New configuration name ofdefault_chmod
as of V7 -
securityKey | string (default: 'auto')
[>=V4]
A security key that define the subdirectory name. 'auto' value will be the HTTP_HOST value. -
htaccess | bool (default: true)
[>=V4 <V9]
Option designed to (dis)allow the auto-generation of .htaccess. -
autoTmpFallback | bool (default: false)
[>=V6]
Option designed to automatically attempt to fallback to temporary directory if the cache fails to write on the specified directory -
secureFileManipulation | bool (default: false)
[>=V6]
This option enforces a strict I/O manipulation policy by adding more integrity checks. This option may slow down the write operations, therefore you must use it with caution. In case of failure an phpFastCacheIOException exception will be thrown. Currently only supported by Files driver. -
cacheFileExtension | string (default: 'txt')
[>=V6.0.2]
This allows you to setup a custom (but safe) cache file extension.
* Drivers like Files, Sqlite, Leveldb, etc.
-
fallback | string|bool (default: false)
[>=V4.2]
A driver name used in case the main driver stopped working. E.g. a missing php extension. -
fallbackConfig | ConfigurationOption|null (default: null)
[>=V7]
A dedicatedConfigurationOption
object for thefallback
driver, if needed. -
limited_memory_each_object | int (default: 4096)
[>=V4.2]
Maximum size (bytes) of object stored in memory. Currently only supported by Cookie driver. -
defaultTtl | int (default: 900)
[>=V5]
This option define a default ttl (time-to-live, in seconds) for item that has no specified expiration date/ttl. -
itemDetailedDate | bool (default: false)
[>=V6]
This option will define if the Items will make use of detailed dates such as Creation/modification date. Trying to access to these date without being explicitly enabled will throw aLogicException
-
defaultKeyHashFunction | string (default: 'md5')
[>=V6]
This option will allow you to define a custom hash function for the$item->getEncodedKey()
method. Callable objects are not allowed, but static method such as\Absolute\Namespace\ToStatic::method
are allowed. -
defaultFileNameHashFunction | string (default: 'md5')
[>=V7]
This option will allow you to define a custom hash function for every I/O method that ends up to write an hashed filename on the disk. -
preventCacheSlams | bool (default: false)
[>=V6]
This option will allow you to prevent cache slams when making use of heavy cache items -
cacheSlamsTimeout | int (default: 15)
[>=V6]
This option defines the cache slams timeout in seconds -
useStaticItemCaching | bool(default: true)
[>=V8.0.3]
This option will allow you to disable the internal static storage of cache items. Can be used for cron script that loop indefinitely on cache items to avoid callingdetachAllItems()
/detachItem($item)
from the cache pool.
- host | string (default: null) The hostname
-
path | string (default: null|string[temp. dir.])
[>=V4], [>=V6.1]
The absolute path where the written cache files belong to (system temp directory by default). As of the V6.1 this option is also used to define (P)redis and Memcache(d) UNIX socket - port | int (default: null) The port
- username | string (default: null) The username
- password | string (default: null) The password
- timeout | int (default: null) The timeout (in seconds)
- servers | array (default: null) Array of servers. Exclusive to Memcache(d)
-
redisClient | \Redis (default: null)
[>=V7]
An optional Redis Client created outside Phpfastcache's scope. This option overrides every Host/Authenticating options -
predisClient | \Predis\Client (default: null)
[>=V7]
An optional Predis Client created outside Phpfastcache's scope. This option overrides every Host/Authenticating options
These options differs depending the driver that you are using, see /Examples folder for more information about these options.
* Drivers like CouchBase, MongoDb, (P)redis, Ssdb, etc.
-
compress_data | bool (default: false)
[>=V4.3 <V6.0]
Compress stored data, if the backend supports it. Currently only supported by Memcache(d) driver.
❓ Finally, if you need help, always check out the inevitable README.md