Menu

## Service extends BaseService
in package
Uses Cacheable

Service.php : 11

Base Service for generic services

### Table of Contents

#### Properties

$cachePrefix : string
  The cache prefix to use for caching.
$cacheTtl : int
  The cache ttl to use for caching.
$cacheInstance : PioniaCache|null
  The cache instance to use for caching.

#### Methods

cache() : bool|mixed
  Caches the value if the value is not null.
ClearByKeys() : bool
  Clear the cache.
deleteCache() : bool
  Delete the cache for the key.
getCache() : mixed
getCacheInstance() : PioniaCache|null
hasCache() : bool
  Check if the cache has the key.
setCache() : bool
setCacheInstance() : void
  Set the cache instance to use for caching.
updateCache() : void
cleanCacheKey() : string
getKeyName() : string
  Converts the key to snake case and appends the current class prefix if it does not exist.
logger() : LoggerInterface|null

### Properties

#### $cachePrefix

Cacheable.php : 24

The cache prefix to use for caching.

`public string $cachePrefix = __CLASS__`

#### $cacheTtl

Cacheable.php : 30

The cache ttl to use for caching.

`public int $cacheTtl = 60`

Defaults to 60 seconds.

#### $cacheInstance

Cacheable.php : 19

The cache instance to use for caching.

`private PioniaCache|null $cacheInstance = null`

### Methods

#### cache()

Cacheable.php : 53

Caches the value if the value is not null.

`public cache(string $key[, mixed $value = null ][, mixed $ttl = null ][, bool|null $exact = false ]) : bool|mixed`

##### Parameters

$key : string

  The key to cache

$value : mixed = null

  The value to cache

$ttl : mixed = null

  The time to live for the cache

$exact : bool|null = false

  If passed, the key won't be parsed at all, it will be cached as is.

##### Return values

bool|mixed

#### ClearByKeys()

Cacheable.php : 205

Clear the cache.

`public ClearByKeys(array<string|int, mixed> $keys[, bool|null $exact = false ]) : bool`

##### Parameters

$keys : array<string|int, mixed>

  The keys to clear

$exact : bool|null = false

  If passed, the keys won't be parsed at all

##### Return values

bool

#### deleteCache()

Cacheable.php : 130

Delete the cache for the key.

`public deleteCache(string $key[, bool $exact = false ]) : bool`

##### Parameters

$key : string

  The key to delete

$exact : bool = false

  If passed, the key won't be parsed at all

##### Return values

bool

#### getCache()

Cacheable.php : 84
`public getCache( $key[, bool|null $exact = false ]) : mixed`

##### Parameters

$key :
$exact : bool|null = false

#### getCacheInstance()

Cacheable.php : 221
`public getCacheInstance() : PioniaCache|null`

##### Return values

PioniaCache|null

#### hasCache()

Cacheable.php : 183

Check if the cache has the key.

`public hasCache( $key[, bool|null $exact = false ]) : bool`

Will not throw an exception if the key is not set or the cache is not activated.

##### Parameters

$key :
$exact : bool|null = false

##### Return values

bool

#### setCache()

Cacheable.php : 102
`public setCache(string $key, mixed $value[, mixed $ttl = null ][, bool|null $exact = false ]) : bool`

##### Parameters

$key : string
$value : mixed
$ttl : mixed = null
$exact : bool|null = false

##### Return values

bool

#### setCacheInstance()

Cacheable.php : 36

Set the cache instance to use for caching.

`public setCacheInstance(PioniaCache|null $cache) : void`

##### Parameters

$cache : PioniaCache|null

#### updateCache()

Cacheable.php : 71
`public updateCache(mixed $key, mixed $newValue[, mixed $exact = false ][, int|null $ttl = null ]) : void`

##### Parameters

$key : mixed
$newValue : mixed
$exact : mixed = false
$ttl : int|null = null

#### cleanCacheKey()

Cacheable.php : 166
`private cleanCacheKey(string $key) : string`

##### Parameters

$key : string

##### Return values

string

#### getKeyName()

Cacheable.php : 152

Converts the key to snake case and appends the current class prefix if it does not exist.

`private getKeyName(string $key) : string`

##### Parameters

$key : string

##### Return values

string

#### logger()

Cacheable.php : 226
`private logger() : LoggerInterface|null`

##### Return values

LoggerInterface|null

## Search results