| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * Created by PhpStorm. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * User: john | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * Date: 1.04.19 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * Time: 8:36 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | namespace Sf4\Api\Services; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | use Psr\Cache\CacheItemInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | use Psr\Cache\InvalidArgumentException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | use Symfony\Contracts\Cache\CallbackInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | use Symfony\Contracts\Cache\ItemInterface; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | class NoCacheAdapter implements CacheAdapterInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |      * Returns a Cache Item representing the specified key. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |      * This method must always return a ItemInterface object, even in case of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |      * a cache miss. It MUST NOT return null. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |      * @param string $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |      *   The key for which to return the corresponding Cache Item. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * @throws InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      *   MUST be thrown. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * @return ItemInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      *   The corresponding Cache Item. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |     public function getItem($key): ?ItemInterface | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * Returns a traversable set of cache items. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |      * @param string[] $keys | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |      *   An indexed array of keys of items to retrieve. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      * @throws InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      *   If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |      *   MUST be thrown. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      * @return array|\Traversable | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      *   A traversable collection of Cache Items keyed by the cache keys of | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      *   each item. A Cache item will be returned for each key, even if that | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |      *   key is not found. However, if no keys are specified then an empty | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |      *   traversable MUST be returned instead. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |     public function getItems(array $keys = array()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         return []; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |      * Confirms if the cache contains specified cache item. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |      * Note: This method MAY avoid retrieving the cached value for performance reasons. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |      * This could result in a race condition with ItemInterface::get(). To avoid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |      * such situation use ItemInterface::isHit() instead. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |      * @param string $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |      *   The key for which to check existence. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |      * @throws InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      *   MUST be thrown. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      *   True if item exists in the cache, false otherwise. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |     public function hasItem($key): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |         return false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * Deletes all items in the pool. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |      *   True if the pool was successfully cleared. False if there was an error. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |     public function clear(): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |      * Removes the item from the pool. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |      * @param string $key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |      *   The key to delete. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |      * @throws InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |      *   If the $key string is not a legal value a \Psr\Cache\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |      *   MUST be thrown. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |      *   True if the item was successfully removed. False if there was an error. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |     public function deleteItem($key): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |      * Removes multiple items from the pool. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |      * @param string[] $keys | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |      *   An array of keys that should be removed from the pool. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |      * @throws InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |      *   If any of the keys in $keys are not a legal value a \Psr\Cache\InvalidArgumentException | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |      *   MUST be thrown. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |      *   True if the items were successfully removed. False if there was an error. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     public function deleteItems(array $keys): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |      * Persists a cache item immediately. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |      * @param CacheItemInterface $item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |      *   The cache item to save. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |      *   True if the item was successfully persisted. False if there was an error. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |     public function save(CacheItemInterface $item): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |      * Sets a cache item to be persisted later. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |      * @param CacheItemInterface $item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |      *   The cache item to save. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |      *   False if the item could not be queued or if a commit was attempted and failed. True otherwise. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |     public function saveDeferred(CacheItemInterface $item): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |      * Persists any deferred cache items. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |      *   True if all not-yet-saved items were successfully saved or there were none. False otherwise. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 162 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 163 |  |  |     public function commit(): bool | 
            
                                                                        
                            
            
                                    
            
            
                | 164 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 165 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |      * Fetches a value from the pool or computes it if not found. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |      * On cache misses, a callback is called that should return the missing value. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |      * This callback is given a PSR-6 ItemInterface instance corresponding to the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |      * requested key, that could be used e.g. for expiration control. It could also | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |      * be an ItemInterface instance when its additional features are needed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |      * @param string $key The key of the item to retrieve from the cache | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |      * @param callable|CallbackInterface $callback Should return the computed value for the given key/item | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |      * @param float|null $beta A float that, as it grows, controls the likeliness of triggering | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |      *        early expiration. 0 disables it, INF forces immediate expiration. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |      *        The default (or providing null) is implementation dependent but should | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |      *        typically be 1.0, which should provide optimal stampede protection. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |      *        See https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |      * @param array &$metadata The metadata of the cached item {@see ItemInterface::getMetadata()} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |      * @return mixed The value corresponding to the provided key | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |      * @throws InvalidArgumentException When $key is not valid or when $beta is negative | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |     public function get(string $key, callable $callback, float $beta = null, array &$metadata = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         return null; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |      * Removes an item from the pool. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |      * @param string $key The key to delete | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |      * @throws InvalidArgumentException When $key is not valid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |      * @return bool True if the item was successfully removed, false if there was any error | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     public function delete(string $key): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |      * Invalidates cached items using tags. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |      * @param string[] $tags An array of tags to invalidate | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |      * @return bool True on success | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |     public function invalidateTags(array $tags): bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |         return true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 219 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 220 |  |  |  |