<?php

declare(strict_types=1);

namespace BotGuard\Core\Cache;

/**
 * Cache contract.
 *
 * A single small interface lets the platform swap the file-based driver for
 * Redis (see RedisCache) without touching call sites — satisfying the
 * "Redis ready" performance requirement.
 */
interface CacheInterface
{
    public function get(string $key, mixed $default = null): mixed;

    public function put(string $key, mixed $value, int $ttlSeconds): void;

    public function has(string $key): bool;

    public function forget(string $key): void;

    /**
     * Atomically increment a counter, creating it with the given TTL on first hit.
     * Returns the new value.
     */
    public function increment(string $key, int $ttlSeconds): int;
}
