# auto-alt-text/2.8.2/src/App/Infrastructure/Cache/WordPressTransientCache.php

Auto Alt Text, version 2.8.2. 28 lines.

- Page: https://pluginprobe.com/plugins/auto-alt-text/2.8.2/code/src/App/Infrastructure/Cache/WordPressTransientCache.php
- Raw: https://pluginprobe.com/plugins/auto-alt-text/2.8.2/raw/src/App/Infrastructure/Cache/WordPressTransientCache.php
- Modified: 2026-06-03T12:19:36+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/auto-alt-text/2.8.2/code/src/App/Infrastructure/Cache/WordPressTransientCache.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace AATXT\App\Infrastructure\Cache;

/**
 * Cache implementation backed by the WordPress Transients API.
 */
class WordPressTransientCache implements CacheInterface
{
    public function get(string $key)
    {
        $value = get_transient($key);
        return $value === false ? null : $value;
    }

    public function set(string $key, $value, int $ttl): void
    {
        set_transient($key, $value, $ttl);
    }

    public function delete(string $key): void
    {
        delete_transient($key);
    }
}

```
