class CacheDecorator implements PermissionRepository

Class CacheDecorator

Properties

protected PermissionRepository $repo PermissionRepository instance
protected Repository $cache Cache instance
protected int $minutes expire time
protected string $prefix Prefix for cache key
protected array $bag memory cache

Methods

__construct(PermissionRepository $repo, Repository $cache, int $minutes = 60)

CacheDecorator constructor.

findByName(string $siteKey, string $name)

Find a registered by type and name

insert(Permission $item)

Insert register information

update(Permission $item)

Update register information

int
delete(Permission $item)

Delete register information

array
fetchAncestor(string $siteKey, string $name)

Returns ancestor of item

array
fetchDescendant(string $siteKey, string $name)

Returns descendant of item

void
foster(Permission $item, string $to)

Parent Changing with descendant

void
affiliate(Permission $item, string $to)

affiliated to another registered

array
getData(string $siteKey, string $head)

get cached data

void
erase(string $siteKey, string $name)

Remove cache data

string
getHead(string $name)

parse name to head and segments

string
makeKey(string $siteKey, string $name)

Make key by combination of site key and target name

string
getCacheKey(string $keyword)

String for cache key

Details

at line 76
__construct(PermissionRepository $repo, Repository $cache, int $minutes = 60)

CacheDecorator constructor.

Parameters

PermissionRepository $repo PermissionRepository instance
Repository $cache Cache instance
int $minutes expire time

at line 90
Permission findByName(string $siteKey, string $name)

Find a registered by type and name

Parameters

string $siteKey site key
string $name target name

Return Value

Permission

at line 105
Permission insert(Permission $item)

Insert register information

Parameters

Permission $item permission instance

Return Value

Permission

at line 118
Permission update(Permission $item)

Update register information

Parameters

Permission $item permission instance

Return Value

Permission

at line 131
int delete(Permission $item)

Delete register information

Parameters

Permission $item permission instance

Return Value

int affecting statement

at line 145
array fetchAncestor(string $siteKey, string $name)

Returns ancestor of item

Parameters

string $siteKey site key
string $name target name

Return Value

array

at line 161
array fetchDescendant(string $siteKey, string $name)

Returns descendant of item

Parameters

string $siteKey site key
string $name target name

Return Value

array

at line 177
void foster(Permission $item, string $to)

Parent Changing with descendant

Parameters

Permission $item permission instance
string $to parent name

Return Value

void

at line 192
void affiliate(Permission $item, string $to)

affiliated to another registered

Parameters

Permission $item permission instance
string $to parent name

Return Value

void

at line 207
protected array getData(string $siteKey, string $head)

get cached data

Parameters

string $siteKey site key
string $head root name

Return Value

array

at line 236
protected void erase(string $siteKey, string $name)

Remove cache data

Parameters

string $siteKey site key
string $name target name

Return Value

void

at line 250
private string getHead(string $name)

parse name to head and segments

Parameters

string $name the name

Return Value

string

at line 264
protected string makeKey(string $siteKey, string $name)

Make key by combination of site key and target name

Parameters

string $siteKey site key
string $name target name

Return Value

string

at line 275
protected string getCacheKey(string $keyword)

String for cache key

Parameters

string $keyword keyword

Return Value

string