C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$RTQJQKE\libraries\classes\Cache.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php

declare(strict_types=1);

namespace 
PhpMyAdmin;

use function 
array_key_exists;

/**
 * Cache values
 */
class Cache
{
    
/** @var array<string,mixed> */
    
private static $cacheData = [];

    
/**
     * Store a value
     *
     * @param string $cacheKey The key to use
     * @param mixed  $value    The value to cache
     */
    
public static function set(string $cacheKey$value): bool
    
{
        
self::$cacheData[$cacheKey] = $value;

        return 
true;
    }

    
/**
     * Does the cache have a value stored for the key
     *
     * @param string $cacheKey The key to use
     */
    
public static function has(string $cacheKey): bool
    
{
        return 
array_key_exists($cacheKeyself::$cacheData);
    }

    
/**
     * Get back a cached value
     *
     * @param string $cacheKey     The key to use
     * @param mixed  $defaultValue The default value in case it does not exist
     *
     * @return mixed The cached value
     */
    
public static function get(string $cacheKey$defaultValue null)
    {
        return 
self::$cacheData[$cacheKey] ?? $defaultValue;
    }

    
/**
     * Remove a cached value
     *
     * @param string $cacheKey The key to use to remove the value
     */
    
public static function remove(string $cacheKey): bool
    
{
        unset(
self::$cacheData[$cacheKey]);

        return 
true;
    }

    
/**
     * Purge all cached values
     */
    
public static function purge(): bool
    
{
        
self::$cacheData = [];

        return 
self::$cacheData === [];
    }
}