Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor cache configuration #1

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0
- nightly

env:
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ If you are using [_locomotivemtl/charcoal-app_][charcoal-app], the [`CacheServic

#### Required

- [**PHP 5.6+**](https://php.net): _PHP 7_ is recommended.
- [**PHP 7.3+**](https://php.net)
- [**tedivm/stash**][stash]: PSR-6 compliant caching library.
- [**pimple/pimple**][pimple]: PSR-11 compliant service container and provider library.
- [**locomotivemtl/charcoal-config**][charcoal-config]: For configuring the caching service.
Expand Down Expand Up @@ -357,9 +357,9 @@ The charcoal-cache module follows the Charcoal coding-style:
[phpunit]: https://packagist.org/packages/phpunit/phpunit
[phpcs]: https://packagist.org/packages/squizlabs/php_codesniffer
[phpcov]: https://packagist.org/packages/php-coveralls/php-coveralls
[stash-drivers]: https://github.com/tedious/Stash/blob/v0.14.2/src/Stash/DriverList.php
[stash-drivers]: https://github.com/tedious/Stash/blob/v0.17.2/src/Stash/DriverList.php
[stash-docs]: https://www.stashphp.com/
[stash-license]: https://github.com/tedious/Stash/blob/v0.14.2/LICENSE
[stash-license]: https://github.com/tedious/Stash/blob/v0.17.2/LICENSE

[dev-scrutinizer]: https://scrutinizer-ci.com/g/locomotivemtl/charcoal-cache/
[dev-coveralls]: https://coveralls.io/r/locomotivemtl/charcoal-cache
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
"prefer-stable": true,
"extra": {
"branch-alias": {
"dev-master": "0.2.x-dev"
"dev-master": "0.3.x-dev"
}
},
"require": {
"php": ">=5.6.0 || >=7.0",
"locomotivemtl/charcoal-config": "~0.8",
"php": "^7.3 || ^8.0",
"locomotivemtl/charcoal-config": "~0.10",
"pimple/pimple": "^3.0",
"psr/cache": "^1.0",
"tedivm/stash": "~0.14"
"tedivm/stash": "~0.17"
},
"require-dev": {
"psr/log": "^1.0",
Expand Down
20 changes: 10 additions & 10 deletions src/Charcoal/Cache/CacheConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CacheConfig extends AbstractConfig
* Default cache type and fallback for user preference.
*/
const DEFAULT_TYPES = [
'memory' => true
'memory' => true,
];

/**
Expand Down Expand Up @@ -71,9 +71,9 @@ public function defaults()
{
return [
'active' => true,
'types' => $this->defaultTypes(),
'types' => $this->getDefaultTypes(),
'default_ttl' => self::WEEK_IN_SECONDS,
'prefix' => self::DEFAULT_NAMESPACE
'prefix' => self::DEFAULT_NAMESPACE,
];
}

Expand All @@ -95,7 +95,7 @@ public function setActive($active)
*
* @return boolean TRUE if enabled, FALSE if disabled.
*/
public function active()
public function getActive()
{
return $this->active;
}
Expand Down Expand Up @@ -138,7 +138,7 @@ public function addTypes(array $types)
*/
public function addType($type)
{
if (!in_array($type, $this->validTypes())) {
if (!in_array($type, $this->getValidTypes())) {
throw new InvalidArgumentException(
sprintf('Invalid cache type: "%s"', $type)
);
Expand All @@ -157,7 +157,7 @@ public function addType($type)
*
* @return array
*/
public function types()
public function getTypes()
{
$types = $this->types + self::DEFAULT_TYPES;
return array_keys($types);
Expand All @@ -168,7 +168,7 @@ public function types()
*
* @return string[]
*/
public function defaultTypes()
public function getDefaultTypes()
{
return array_keys(self::DEFAULT_TYPES);
}
Expand All @@ -178,7 +178,7 @@ public function defaultTypes()
*
* @return string[]
*/
public function validTypes()
public function getValidTypes()
{
return [
'apc',
Expand Down Expand Up @@ -215,7 +215,7 @@ public function setDefaultTtl($ttl)
*
* @return integer
*/
public function defaultTtl()
public function getDefaultTtl()
{
return $this->defaultTtl;
}
Expand Down Expand Up @@ -251,7 +251,7 @@ public function setPrefix($prefix)
*
* @return string
*/
public function prefix()
public function getPrefix()
{
return $this->prefix;
}
Expand Down
Loading