Issues (14)

src/Interface/CacheerInterface.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace Silviooosilva\CacheerPhp\Interface;
4
5
/**
6
 * Class CacheerInterface
7
 * @author Sílvio Silva <https://github.com/silviooosilva>
8
 * @package Silviooosilva\CacheerPhp
9
 */
10
interface CacheerInterface
11
{
12
    
13
    /**
14
     * Appends data to an existing cache item.
15
     *
16
     * @param string $cacheKey Unique item key
17
     * @param mixed $cacheData Data to be appended (serializable)
18
     * @param string $namespace Namespace for organization
19
     * @return mixed True on success, false on failure
20
     */
21
    public function appendCache(string $cacheKey, mixed $cacheData, string $namespace = '');
22
    
23
    /**
24
     * Clears a specific cache item.
25
     *
26
     * @param string $cacheKey Unique item key
27
     * @param string $namespace Namespace for organization
28
     * @return void
29
     */
30
    public function clearCache(string $cacheKey, string $namespace = '');
31
    
32
    /**
33
     * Flushes all cache items.
34
     *
35
     * @return void
36
     */
37
    public function flushCache();
38
39
    /**
40
     * Gets all items in a specific namespace.
41
     *
42
     * @param string $namespace Namespace for organization
43
     * @return CacheDataFormatter|mixed Returns a formatter with all items in the namespace
0 ignored issues
show
The type Silviooosilva\CacheerPhp...face\CacheDataFormatter was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
44
     */
45
    public function getAll(string $namespace);
46
47
    /**
48
     * Retrieves a single cache item.
49
     *
50
     * @param string $cacheKey Unique item key
51
     * @param string $namespace Namespace for organization
52
     * @param string|int $ttl Lifetime in seconds (default: 3600)
53
     * @return mixed Returns the cached data or null if not found
54
     */
55
    public function getCache(string $cacheKey, string $namespace = '', string|int $ttl = 3600);
56
57
    /**
58
     * Retrieves multiple cache items by their keys.
59
     *
60
     * @param array $cacheKeys Array of item keys
61
     * @param string $namespace Namespace for organization
62
     * @param string|int $ttl Lifetime in seconds (default: 3600)
63
     * @return CacheDataFormatter|mixed Returns a formatter with the retrieved items
64
     */
65
    public function getMany(array $cacheKeys, string $namespace, string|int $ttl = 3600);
66
67
    /**
68
     * Checks if a cache item exists.
69
     *
70
     * @param string $cacheKey Unique item key
71
     * @param string $namespace Namespace for organization
72
     * @return bool True if the item exists, false otherwise
73
     */
74
    public function has(string $cacheKey, string $namespace = '');
75
76
    /**
77
     * Stores an item in the cache with a specific TTL.
78
     *
79
     * @param string $cacheKey Unique item key
80
     * @param mixed $cacheData Data to be stored (serializable)
81
     * @param string $namespace Namespace for organization
82
     * @param string|int $ttl Lifetime in seconds (default: 3600)
83
     * @return bool True on success, false on failure
84
     */
85
    public function putCache(string $cacheKey, mixed $cacheData, string $namespace = '', int|string $ttl = 3600);
86
87
    /**
88
     * Stores multiple items in the cache.
89
     *
90
     * @param array $items Array of items to be stored, where keys are cache keys and values are cache data
91
     * @param string $namespace Namespace for organization
92
     * @param int $batchSize Number of items to store in each batch (default: 100)
93
     * @return bool True on success, false on failure
94
     */
95
    public function putMany(array $items, string $namespace = '', int $batchSize = 100);
96
97
    /**
98
     * Renews the cache for a specific key with a new TTL.
99
     *
100
     * @param string $cacheKey Unique item key
101
     * @param int|string $ttl Lifetime in seconds (default: 3600)
102
     * @param string $namespace Namespace for organization
103
     * @return bool True on success, false on failure
104
     */
105
    public function renewCache(string $cacheKey, int | string $ttl, string $namespace = '');
106
}
107
108