CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 4.0 Strawberry API

  • Overview
  • Version:
    • 4.0
      • 4.0
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
    • Database
      • Dialect
      • Driver
      • Exception
      • Expression
      • Log
      • Retry
      • Schema
      • Statement
      • Type
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class CachedCollection

Decorates a schema collection and adds caching

Namespace: Cake\Database\Schema

Properties 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)

Get the cache key for a given name.

Parameters
string $name

The name to get a cache key for.

Returns
string

The cache key.

describe() public

¶

describe(string $name, array $options)

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

The name of the table to describe.

array $options optional

The options to use, see above.

Returns
\Cake\Database\Schema\TableSchemaInterface

Object with column metadata.

Throws
Cake\Database\Exception
when table cannot be described.

getCacher() public

¶

getCacher()

Get a cacher.

Returns
\Psr\SimpleCache\CacheInterface

$cacher Cacher object

listTables() public

¶

listTables()

Get the list of tables available in the current connection.

Returns
string[]

The list of tables in the connected database/schema.

setCacher() public

¶

setCacher(\Psr\SimpleCache\CacheInterface $cacher)

Set a cacher.

Parameters
\Psr\SimpleCache\CacheInterface $cacher

Cacher object

Returns
$this

Property Detail

$cacher ¶ protected

Cacher instance.

Type
\Psr\SimpleCache\CacheInterface

$collection ¶ protected

The decorated schema collection

Type
\Cake\Database\Schema\CollectionInterface

$prefix ¶ protected

The cache key prefix

Type
string