CachedCollection
in package
implements
CollectionInterface
Decorates a schema collection and adds caching
Table of Contents
Interfaces
- CollectionInterface
- Represents a database schema collection
Properties
- $cacher : CacheInterface
- Cacher instance.
- $collection : CollectionInterface
- The decorated schema collection
- $prefix : string
- The cache key prefix
Methods
- __construct() : mixed
- Constructor.
- cacheKey() : string
- Get the cache key for a given name.
- describe() : TableSchemaInterface
- Get the column metadata for a table.
- getCacher() : CacheInterface
- Get a cacher.
- listTables() : array<string|int, string>
- Get the list of tables available in the current connection.
- listTablesWithoutViews() : array<string|int, mixed>
- setCacher() : $this
- Set a cacher.
Properties
$cacher
Cacher instance.
protected
CacheInterface
$cacher
$collection
The decorated schema collection
protected
CollectionInterface
$collection
$prefix
The cache key prefix
protected
string
$prefix
Methods
__construct()
Constructor.
public
__construct(CollectionInterface $collection, string $prefix, CacheInterface $cacher) : mixed
Parameters
- $collection : CollectionInterface
-
The collection to wrap.
- $prefix : string
-
The cache key prefix to use. Typically the connection name.
- $cacher : CacheInterface
-
Cacher instance.
cacheKey()
Get the cache key for a given name.
public
cacheKey(string $name) : string
Parameters
- $name : string
-
The name to get a cache key for.
Return values
string —The cache key.
describe()
Get the column metadata for a table.
public
describe(string $name[, array<string|int, mixed> $options = [] ]) : TableSchemaInterface
Parameters
- $name : string
-
The name of the table to describe.
- $options : array<string|int, mixed> = []
-
The options to use, see above.
Tags
Return values
TableSchemaInterface —Object with column metadata.
getCacher()
Get a cacher.
public
getCacher() : CacheInterface
Return values
CacheInterface —$cacher Cacher object
listTables()
Get the list of tables available in the current connection.
public
listTables() : array<string|int, string>
Tags
Return values
array<string|int, string> —The list of tables in the connected database/schema.
listTablesWithoutViews()
public
listTablesWithoutViews() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>setCacher()
Set a cacher.
public
setCacher(CacheInterface $cacher) : $this
Parameters
- $cacher : CacheInterface
-
Cacher object