Download the PHP package yiisoft/cache-db without Composer
On this page you can find all versions of the php package yiisoft/cache-db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cache-db
Yii Cache Library - DB Handler
This package implements database-based PSR-16 cache.
Supported databases
Packages | PHP | Versions | CI-Actions | |
---|---|---|---|---|
[db-mssql] | 8.0 - 8.2 | 2017 - 2022 | ||
[db-mysql/mariadb] | 8.0 - 8.2 | 5.7-8.0/10.4-10.10 | ||
[db-oracle] | 8.0 - 8.2 | 11C - 21C | ||
[db-pgsql] | 8.0 - 8.2 | 9.0 - 15.0 | ||
[db-sqlite] | 8.0 - 8.2 | 3:latest |
Requirements
- PHP 8.0 or higher.
PDO
PHP extension.
Installation
The package could be installed with Composer:
Create database connection
For more information see yiisoft/db.
Database Preparing
Package provides two way for preparing database:
-
Raw SQL. You can use it with the migration package used in your application.
-
Ensure tables:
- MSSQL,
- MySQL / MariaDB,
- Oracle,
- PostgreSQL
- SQLite
- Ensure no tables:
- MSSQL,
- MySQL / MariaDB,
- Oracle,
- PostgreSQL
- SQLite
-
DbSchemaManager
forensureTable()
,ensureNoTable()
methods for cache table (by default{{%yii_cache}}
).
Configuration
When creating an instance of \Yiisoft\Cache\Db\DbCache
, you must pass an instance of the database connection.
$db (\Yiisoft\Db\Connection\ConnectionInterface)
- The database connection instance.$table (string)
- The name of the database table to store the cache data. Defaults to "cache".$gcProbability (int)
- The probability (parts per million) that garbage collection (GC) should be performed when storing a piece of data in the cache. Defaults to 100, meaning 0.01% chance. This number should be between 0 and 1000000. A value 0 meaning no GC will be performed at all.
General usage
The package does not contain any additional functionality for interacting with the cache, except those defined in the PSR-16 interface.
In order to delete value you can use:
To work with values in a more efficient manner, batch operations should be used:
getMultiple()
setMultiple()
deleteMultiple()
This package can be used as a cache handler for the Yii Caching Library.
Additional logging
In order to log details about failures you may set a logger instance. It should be Psr\Log\LoggerInterface::class
. For example, you can use yiisoft\Log:
This allows you to log cache operations, when ocurring errors, etc.
Documentation
- Internals
If you need help or have a question, the Yii Forum is a good place for that. You may also check out other Yii Community Resources.
License
The Yii Cache Library - DB Handler is free software. It is released under the terms of the BSD License.
Please see LICENSE
for more information.
Maintained by Yii Software.
Support the project
Follow updates
All versions of cache-db with dependencies
ext-pdo Version *
psr/log Version ^2.0|^3.0
psr/simple-cache Version ^2.0|^3.0
yiisoft/db Version ^1.0