Magrathea PHP 2

MagratheaCache extends Singleton
in package

MagratheaCache: cache static responses to save some processing time

Table of Contents

Properties

$cacheName  : mixed
$saveCache  : bool
$instance  : array<string|int, mixed>|null
$cachePath  : mixed
$extension  : mixed

Methods

__wakeup()  : mixed
Cache()  : mixed
Initiates the cache and displays the cached data if already available (killing the execution)
Clear()  : mixed
Clears cache for given cache name
DeleteFile()  : mixed
Deletes a file from cache
GetCacheFile()  : string
Get full cache file path
GetCachePath()  : string
Gets the path where cached files will be stored
HandleApiCache()  : mixed
Handles data from the API to save it on cache and displays it, killing the execution
Initialize()  : mixed
Instance()  : static|Singleton
LoadCachePath()  : MagratheaCache
Loads the cache path from config file
LookForFile()  : mixed
Checks if the cached file exists.
MockClass()  : static|Singleton
RemoveAllCache()  : array<string|int, mixed>
deletes all files from cached path
RemovePattern()  : array<string|int, mixed>
deletes files with pattern
SaveFile()  : mixed
Saves cache file info
SetInstance()  : mixed
ShowJson()  : mixed
Shows a json and kills execution
Type()  : MagratheaCache
Sets the type of cached file (html, json, txt, etc)
__clone()  : mixed
__construct()  : mixed
CreateHandle()  : mixed

Properties

$instance

protected static array<string|int, mixed>|null $instance = []

Methods

Cache()

Initiates the cache and displays the cached data if already available (killing the execution)

public Cache( $name[,  $data = null ]) : mixed
Parameters
$name :

cached name

$data : = null

(optional) reference to identify cached data

Clear()

Clears cache for given cache name

public Clear( $name[,  $data = null ]) : mixed
Parameters
$name :

cached name

$data : = null

(optional) reference to identify cached data

DeleteFile()

Deletes a file from cache

public DeleteFile(string $file[, bool $addExtension = true ]) : mixed
Parameters
$file : string
$addExtension : bool = true

GetCacheFile()

Get full cache file path

public GetCacheFile() : string
Return values
string

path

GetCachePath()

Gets the path where cached files will be stored

public GetCachePath() : string
Return values
string

HandleApiCache()

Handles data from the API to save it on cache and displays it, killing the execution

public HandleApiCache(array<string|int, mixed> $data) : mixed
Parameters
$data : array<string|int, mixed>

LookForFile()

Checks if the cached file exists.

public LookForFile() : mixed

Displays it if does (and kills execution)

RemoveAllCache()

deletes all files from cached path

public RemoveAllCache() : array<string|int, mixed>
Return values
array<string|int, mixed>

deleted files

RemovePattern()

deletes files with pattern

public RemovePattern(string $pattern) : array<string|int, mixed>
Parameters
$pattern : string
Return values
array<string|int, mixed>

deleted files

SaveFile()

Saves cache file info

public SaveFile(string $data) : mixed
Parameters
$data : string

SetInstance()

public SetInstance(mixed $inst) : mixed
Parameters
$inst : mixed

ShowJson()

Shows a json and kills execution

public ShowJson(array<string|int, mixed>|string $data) : mixed
Parameters
$data : array<string|int, mixed>|string

__construct()

private final __construct() : mixed

CreateHandle()

private CreateHandle(string $name[, mixed $data = null ]) : mixed
Parameters
$name : string
$data : mixed = null

        
On this page

Search results