[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-includes/ai-client/adapters/ -> class-wp-ai-client-cache.php (summary)

WP AI Client: WP_AI_Client_Cache class

File Size: 216 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_AI_Client_Cache:: (10 methods):
  get()
  set()
  delete()
  clear()
  getMultiple()
  setMultiple()
  deleteMultiple()
  has()
  ttl_to_seconds()
  iterable_to_array()


Class: WP_AI_Client_Cache  - X-Ref

WordPress-specific PSR-16 cache adapter for the AI Client.

Bridges PSR-16 cache operations to WordPress object cache functions,
enabling the AI client to leverage WordPress caching infrastructure.

get( $key, $default_value = null )   X-Ref
Fetches a value from the cache.

return: mixed The value of the item from the cache, or $default_value in case of cache miss.
param: string $key           The unique key of this item in the cache.
param: mixed  $default_value Default value to return if the key does not exist.

set( $key, $value, $ttl = null )   X-Ref
Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.

return: bool True on success and false on failure.
param: string                $key   The key of the item to store.
param: mixed                 $value The value of the item to store, must be serializable.
param: null|int|DateInterval $ttl   Optional. The TTL value of this item.

delete( $key )   X-Ref
Delete an item from the cache by its unique key.

return: bool True if the item was successfully removed. False if there was an error.
param: string $key The unique cache key of the item to delete.

clear()   X-Ref
Wipes clean the entire cache's keys.

This method only clears the cache group used by this adapter. If the underlying
cache implementation does not support group flushing, this method returns false.

return: bool True on success and false on failure.

getMultiple( $keys, $default_value = null )   X-Ref
Obtains multiple cache items by their unique keys.

return: array<string, mixed> A list of key => value pairs.
param: iterable<string> $keys          A list of keys that can be obtained in a single operation.
param: mixed            $default_value Default value to return for keys that do not exist.

setMultiple( $values, $ttl = null )   X-Ref
Persists a set of key => value pairs in the cache, with an optional TTL.

return: bool True on success and false on failure.
param: iterable<string, mixed> $values A list of key => value pairs for a multiple-set operation.
param: null|int|DateInterval   $ttl    Optional. The TTL value of this item.

deleteMultiple( $keys )   X-Ref
Deletes multiple cache items in a single operation.

return: bool True if the items were successfully removed. False if there was an error.
param: iterable<string> $keys A list of string-based keys to be deleted.

has( $key )   X-Ref
Determines whether an item is present in the cache.

return: bool True if the item exists in the cache, false otherwise.
param: string $key The cache item key.

ttl_to_seconds( $ttl )   X-Ref
Converts a PSR-16 TTL value to seconds for WordPress cache functions.

return: int The TTL in seconds, or 0 for no expiration.
param: null|int|DateInterval $ttl The TTL value.

iterable_to_array( $items )   X-Ref
Converts an iterable to an array.

return: array<mixed> The array.
param: iterable<mixed> $items The iterable to convert.



Generated : Sat Jun 13 09:38:55 2026 Cross-referenced by PHPXref