\GB_Object_Cache
GeniBase Object Cache
The GeniBase Object Cache is used to save on trips to the database. The
Object Cache stores all of the cache data to memory and makes the cache
contents available by using a key, which is used to name and later retrieve
the cache contents.
The Object Cache can be replaced by other caching mechanisms by placing files
in the gb-content folder. If that file exists, then this file will not be
included.
Synopsis
- // members
- private static array $cache = ;
- private static integer $cache_hits = 0;
- public static integer $cache_misses = 0;
- private static array $global_groups = ;
- // methods
- public static bool add()
- public static void add_global_groups()
- public static false|int decr()
- public static bool delete()
- public static bool flush()
- public static bool|mixed get()
- public static false|int incr()
- public static bool replace()
- public static bool set()
- public static void stats()
- protected static bool _exists()
Violations
PHPMessDetector
Line | Rule | Message |
---|---|---|
167 | UnusedFormalParameter | Avoid unused parameters such as '$deprecated'. |
213 | UnusedFormalParameter | Avoid unused parameters such as '$force'. |
317 | UnusedFormalParameter | Avoid unused parameters such as '$expire'. |
Checkstyle
Line | Column | Severity | Message |
---|---|---|---|
87 | 5 | error | The static declaration must come after the visibility declaration |
89 | 9 | error | Inline control structures are not allowed |
92 | 9 | error | Inline control structures are not allowed |
95 | 9 | error | Inline control structures are not allowed |
109 | 5 | error | The static declaration must come after the visibility declaration |
109 | 19 | error | Method name "GB_Object_Cache::add_global_groups" is not in camel caps format |
130 | 5 | error | The static declaration must come after the visibility declaration |
132 | 9 | error | Inline control structures are not allowed |
135 | 9 | error | Inline control structures are not allowed |
138 | 9 | error | Inline control structures are not allowed |
145 | 9 | error | Inline control structures are not allowed |
167 | 5 | error | The static declaration must come after the visibility declaration |
169 | 9 | error | Inline control structures are not allowed |
172 | 9 | error | Inline control structures are not allowed |
186 | 5 | error | The static declaration must come after the visibility declaration |
213 | 5 | error | The static declaration must come after the visibility declaration |
215 | 9 | error | Inline control structures are not allowed |
221 | 13 | error | Inline control structures are not allowed |
223 | 13 | error | Expected 1 space after ELSE keyword; newline found |
223 | 13 | error | Inline control structures are not allowed |
245 | 5 | error | The static declaration must come after the visibility declaration |
247 | 9 | error | Inline control structures are not allowed |
250 | 9 | error | Inline control structures are not allowed |
253 | 9 | error | Inline control structures are not allowed |
260 | 9 | error | Inline control structures are not allowed |
282 | 5 | error | The static declaration must come after the visibility declaration |
284 | 9 | error | Inline control structures are not allowed |
287 | 9 | error | Inline control structures are not allowed |
317 | 5 | error | The static declaration must come after the visibility declaration |
319 | 9 | error | Inline control structures are not allowed |
322 | 9 | error | Inline control structures are not allowed |
337 | 5 | error | The static declaration must come after the visibility declaration |
347 | 125 | warning | Line exceeds 120 characters; contains 125 characters |
362 | 5 | error | The static declaration must come after the visibility declaration |
362 | 22 | warning | Method name "_exists" should not be prefixed with an underscore to indicate visibility |
364 | 163 | warning | Line exceeds 120 characters; contains 163 characters |
Members
private
- $cache
—
array
Holds the cached objects - $cache_hits
—
int
The amount of times the cache data was already stored in the cache. - $global_groups
—
array
List of global groups
public
- $cache_misses
—
int
Amount of times the cache did not have the request in cache
Methods
protected
- _exists() — Utility function to determine whether a key exists in the cache.
public
- add() — Adds data to the cache if it doesn't already exist.
- add_global_groups() — Sets the list of global groups.
- decr() — Decrement numeric cache item's value
- delete() — Remove the contents of the cache key in the group
- flush() — Clears the object cache of all data
- get() — Retrieves the cache contents, if it exists
- incr() — Increment numeric cache item's value
- replace() — Replace the contents in the cache, if contents already exist
- set() — Sets the data contents into the cache
- stats() — Echoes the stats of the caching.
History
-
2017-05-16T19:52:59+00:00 (commit #fd0a296)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
PSR-2 applied
-
2016-01-25T17:45:50+00:00 (commit #97e2af2)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
Pre v.3.0
-
2015-03-29T13:30:08+00:00 (commit #363a6b3)
Author: Limych (andrey@khrolenok.ru) / Commiter: Limych (andrey@khrolenok.ru)
#75: Система внутреннего кэширования объектов (для целей ускорения) https://github.com/Limych/GeniBase/issues/issue/75