Class CachedCollection
Decorates a schema collection and adds caching
Namespace: Cake\Database\Schema
Property Summary
-
$cacher protected
Psr\SimpleCache\CacheInterface
Cacher instance.
-
$collection protected
Cake\Database\Schema\CollectionInterface
The decorated schema collection
-
$prefix protected
string
The cache key prefix
Method Summary
-
__construct() public
Constructor.
-
cacheKey() public
Get the cache key for a given name.
-
describe() public
Get the column metadata for a table.
-
getCacher() public
Get a cacher.
-
listTables() public
Get the list of tables available in the current connection.
-
setCacher() public
Set a cacher.
Method Detail
__construct() ¶ public
__construct(Cake\Database\Schema\CollectionInterface $collection, string $prefix, Psr\SimpleCache\CacheInterface $cacher)
Constructor.
Parameters
-
Cake\Database\Schema\CollectionInterface
$collection The collection to wrap.
-
string
$prefix The cache key prefix to use. Typically the connection name.
-
Psr\SimpleCache\CacheInterface
$cacher Cacher instance.
cacheKey() ¶ public
cacheKey(string $name): string
Get the cache key for a given name.
Parameters
-
string
$name The name to get a cache key for.
Returns
string
describe() ¶ public
describe(string $name, array $options = []): Cake\Database\Schema\TableSchemaInterface
Get the column metadata for a table.
Caching will be applied if cacheMetadata
key is present in the Connection
configuration options. Defaults to _cakemodel when true.
Options
forceRefresh
- Set to true to force rebuilding the cached metadata. Defaults to false.
Parameters
-
string
$name -
array
$options optional
Returns
Cake\Database\Schema\TableSchemaInterface
getCacher() ¶ public
getCacher(): Psr\SimpleCache\CacheInterface
Get a cacher.
Returns
Psr\SimpleCache\CacheInterface
listTables() ¶ public
listTables(): string[]
Get the list of tables available in the current connection.
Returns
string[]
setCacher() ¶ public
setCacher(Psr\SimpleCache\CacheInterface $cacher): $this
Set a cacher.
Parameters
-
Psr\SimpleCache\CacheInterface
$cacher Cacher object
Returns
$this