Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions system/Cache/CacheInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

namespace CodeIgniter\Cache;

use Closure;

interface CacheInterface
{
/**
Expand All @@ -38,6 +40,16 @@ public function get(string $key): mixed;
*/
public function save(string $key, mixed $value, int $ttl = 60): bool;

/**
* Attempts to get an item from the cache, or executes the callback
* and stores the result on cache miss.
*
* @param string $key Cache item name
* @param int $ttl Time To Live, in seconds
* @param Closure(): mixed $callback Callback executed on cache miss
*/
public function remember(string $key, int $ttl, Closure $callback): mixed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update BaseHandler::remember() to remove the redundant PHPDocs


/**
* Deletes a specific item from the cache store.
*
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelogs/v4.7.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ Interface Changes

- **Cache:** The ``CacheInterface`` now includes the ``deleteMatching()`` method. If you've implemented your own caching driver from scratch, you will need to provide an implementation for this method to ensure compatibility.
- **Images:** The ``ImageHandlerInterface`` now includes a new method: ``clearMetadata()``. If you've implemented your own handler from scratch, you will need to provide an implementation for this method to ensure compatibility.
- **Cache:** The ``CacheInterface`` now includes the ``remember()`` method. All built-in cache handlers inherit this method via ``BaseHandler``, so no changes are required for them. If you have implemented your own caching driver directly from ``CacheInterface``, you will need to provide an implementation for ``remember()`` to maintain compatibility.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this up to maintain alphabetical order.


Method Signature Changes
========================
Expand Down
Loading