Skip to content

Commit

Permalink
Fix phpdoc QueryCache::class, SchemaCache::class. (#433)
Browse files Browse the repository at this point in the history
* Fix phpdoc `QueryCache::class`, `SchemaCache::class`.
  • Loading branch information
terabytesoftw committed Dec 26, 2022
1 parent 814cfa9 commit b7422d4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
18 changes: 15 additions & 3 deletions src/Cache/QueryCache.php
Expand Up @@ -12,7 +12,19 @@
use function is_array;

/**
* The cache application component that is used for query caching.
* QueryCache is a class provides a query cache feature for DB connections.
*
* The query cache allows you to cache the results of SELECT queries for a certain period of time. This can improve the
* performance of your application by avoiding the need to execute the same SELECT query multiple times.
*
* To use the query cache, you can configure a DB connection to use a QueryCache object as its query cache. When you
* execute a SELECT query using this connection, the query cache will check if the results of the query have been
* cached. If they have, it will return the cached results. If not, it will execute the query and cache the results
* before returning them.
*
* You can specify the lifetime of the cache using the {@see duration} property. You can also specify a cache
* dependency, which determines when the cache should be invalidated. For example, you can use a cache dependency based
* on the modification time of a table, so that the cache is invalidated whenever the table is updated.
*/
final class QueryCache
{
Expand All @@ -25,15 +37,15 @@ public function __construct(private CacheInterface $cache)
}

/**
* Return number of seconds that query results can remain valid in cache.
* @return int|null The number of seconds that query results can remain valid in cache.
*/
public function getDuration(): int|null
{
return $this->duration;
}

/**
* Return true if QueryCache is active.
* @return bool True if QueryCache is active.
*/
public function isEnabled(): bool
{
Expand Down
15 changes: 11 additions & 4 deletions src/Cache/SchemaCache.php
Expand Up @@ -10,7 +10,14 @@
use Yiisoft\Cache\Dependency\TagDependency;

/**
* The cache application component that is used to cache the table metadata.
* The SchemaCache class is used to cache database schema information.
*
* The Schema class retrieves information about the database schema from the database server and stores it in the cache
* for faster access. When the Schema class needs to retrieve information about the database schema, it first checks the
* cache using the SchemaCache class. If the information is not in the cache, the Schema class retrieves it from the
* database server and stores it in the cache using the SchemaCache class.
*
* SchemaCache is used by {@see \Yiisoft\Db\Schema\Schema} to cache table metadata.
*/
final class SchemaCache
{
Expand Down Expand Up @@ -57,17 +64,17 @@ public function set(
}

/**
* Return number of seconds that table metadata can remain valid in cache.
* @return int|null The number of seconds that table metadata can remain valid in cache.
*/
public function getDuration(): int|null
{
return $this->duration;
}

/**
* Return true if the table is excluded from cache the table metadata.
*
* @param string $value The table name.
*
* @return bool Whether the table is excluded from caching.
*/
public function isExcluded(string $value): bool
{
Expand Down

0 comments on commit b7422d4

Please sign in to comment.