Skip to content

Commit a7905b5

Browse files
committed
release 1.0.0
1 parent f15d8f1 commit a7905b5

18 files changed

Lines changed: 935 additions & 1 deletion

.editorconfig

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; This file is for unifying the coding style for different editors and IDEs.
2+
; More information at http://editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
indent_style = space
8+
indent_size = 4
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true
12+
13+
[*.bat]
14+
end_of_line = crlf
15+
16+
[*.yml]
17+
indent_size = 2
18+
19+
[*.xml]
20+
indent_size = 2
21+
22+
[Makefile]
23+
indent_style = tab
24+
25+
[*.neon]
26+
indent_style = tab

.gitattributes

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Define the line ending behavior of the different file extensions
2+
# Set default behavior, in case users don't have core.autocrlf set.
3+
* text text=auto eol=lf
4+
5+
.php diff=php
6+
7+
# Declare files that will always have CRLF line endings on checkout.
8+
*.bat eol=crlf
9+
10+
# Declare files that will always have LF line endings on checkout.
11+
*.pem eol=lf
12+
13+
# Denote all files that are truly binary and should not be modified.
14+
*.png binary
15+
*.jpg binary
16+
*.gif binary
17+
*.ico binary
18+
*.mo binary
19+
*.pdf binary
20+
*.phar binary
21+
*.woff binary
22+
*.woff2 binary
23+
*.ttf binary
24+
*.otf binary
25+
*.eot binary
26+
27+
# Remove files for archives generated using `git archive`
28+
.github export-ignore
29+
.phive export-ignore
30+
contrib export-ignore
31+
tests/test_app export-ignore
32+
tests/TestCase export-ignore
33+
34+
.editorconfig export-ignore
35+
.gitattributes export-ignore
36+
.gitignore export-ignore
37+
.mailmap export-ignore
38+
.stickler.yml export-ignore
39+
Makefile export-ignore
40+
phpcs.xml export-ignore
41+
phpstan.neon.dist export-ignore
42+
phpstan-baseline.neon export-ignore
43+
phpunit.xml.dist export-ignore
44+
psalm.xml export-ignore
45+
psalm-baseline.xml export-ignore

.github/workflows/ci.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
6+
pull_request:
7+
branches:
8+
- '*'
9+
10+
jobs:
11+
testsuite:
12+
runs-on: ubuntu-22.04
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php-version: ['8.1', '8.2', '8.3']
17+
db-type: [sqlite, mysql, pgsql]
18+
prefer-lowest: ['']
19+
20+
steps:
21+
- name: Setup MySQL latest
22+
if: matrix.db-type == 'mysql'
23+
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=cakephp -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin
24+
25+
- name: Setup PostgreSQL latest
26+
if: matrix.db-type == 'pgsql'
27+
run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=cakephp -p 5432:5432 -d postgres
28+
29+
- uses: actions/checkout@v4
30+
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: ${{ matrix.php-version }}
35+
extensions: mbstring, intl, apcu, sqlite, pdo_sqlite, pdo_${{ matrix.db-type }}, ${{ matrix.db-type }}
36+
ini-values: apc.enable_cli = 1
37+
coverage: pcov
38+
39+
- name: Get composer cache directory
40+
id: composer-cache
41+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
42+
43+
- name: Get date part for cache key
44+
id: key-date
45+
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT
46+
47+
- name: Cache composer dependencies
48+
uses: actions/cache@v4
49+
with:
50+
path: ${{ steps.composer-cache.outputs.dir }}
51+
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
52+
53+
- name: composer install
54+
run: |
55+
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
56+
composer update --prefer-lowest --prefer-stable
57+
else
58+
composer update
59+
fi
60+
61+
- name: Setup problem matchers for PHPUnit
62+
if: matrix.php-version == '8.1' && matrix.db-type == 'mysql'
63+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
64+
65+
- name: Run PHPUnit
66+
run: |
67+
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DB_URL='sqlite:///:memory:'; fi
68+
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DB_URL='mysql://root:root@127.0.0.1/cakephp?encoding=utf8'; fi
69+
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DB_URL='postgres://postgres:postgres@127.0.0.1/postgres'; fi
70+
vendor/bin/phpunit
71+
72+
cs-stan:
73+
name: Coding Standard & Static Analysis
74+
runs-on: ubuntu-22.04
75+
76+
steps:
77+
- uses: actions/checkout@v4
78+
79+
- name: Setup PHP
80+
uses: shivammathur/setup-php@v2
81+
with:
82+
php-version: '8.1'
83+
extensions: mbstring, intl, apcu
84+
coverage: none
85+
86+
- name: Get composer cache directory
87+
id: composer-cache
88+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
89+
90+
- name: Get date part for cache key
91+
id: key-date
92+
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT
93+
94+
- name: Cache composer dependencies
95+
uses: actions/cache@v4
96+
with:
97+
path: ${{ steps.composer-cache.outputs.dir }}
98+
key: ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
99+
100+
- name: composer install
101+
run: composer stan-setup
102+
103+
- name: Run PHP CodeSniffer
104+
run: composer cs-check
105+
106+
- name: Run psalm
107+
if: success() || failure()
108+
run: vendor/bin/psalm.phar --output-format=github
109+
110+
- name: Run phpstan
111+
if: success() || failure()
112+
run: composer stan

.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/composer.lock
2+
/composer.phar
3+
/phpunit.xml
4+
/.phpunit.result.cache
5+
/phpunit.phar
6+
/config/Migrations/schema-dump-default.lock
7+
/vendor/
8+
/.idea/
9+
*.diff
10+
*.err
11+
*.log
12+
*.orig
13+
*.rej
14+
*.swo
15+
*.swp
16+
*.vi
17+
*~
18+
/.ddev/
19+
.idea/*
20+
nbproject/*
21+
.vscode
22+
.DS_Store
23+
.cache
24+
.project
25+
.settings
26+
.svn
27+
errors.err
28+
tags
29+
node_modules
30+
package-lock.json
31+
/nbproject/
32+
/vendor
33+
/webroot/css/style.css.map
34+
/webroot/mix.js.map
35+
/webroot/mix-manifest.json
36+
/tools/
37+
/.phpunit.cache/
38+
/auth.json

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [2.0] - 2025-08-11
9+
10+
### Added
11+
12+
- First release for CakePHP 5.0
13+
14+
## [1.0] - 2024-08-11
15+
16+
### Added
17+
18+
- First release for CakePHP 4.5

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Contributing
2+
============
3+
4+
This repository follows the [CakeDC Plugin Standard](https://www.cakedc.com/plugin-standard). If you'd like to
5+
contribute new features, enhancements or bug fixes to the plugin, please read our
6+
[Contribution Guidelines](https://www.cakedc.com/contribution-guidelines) for detailed instructions.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Cake Development Corporation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,57 @@
11
# CakeDC Compress Cache Plugin for CakePHP
22

3-
This repository follows the [CakeDC Plugin Standard](https://www.cakedc.com/plugin-standard).
3+
## Versions and branches
4+
| CakePHP | CakeDC Compress Cache Plugin | Tag | Notes |
5+
|:-------:|:---------------------------------------------------------------------------:|:-----:|:-------|
6+
| ^5.0 | [2.0.0](https://github.com/CakeDC/cakephp-compress-cache/tree/2.next-cake5) | 2.0.0 | stable |
7+
| ^4.5 | [1.0.0](https://github.com/CakeDC/cakephp-compress-cache/tree/1.next-cake4) | 1.0.0 | stable |
8+
9+
## Overview
10+
11+
The CakeDC Compress Cache Plugin adds the ability to compress the content of the cache.
12+
13+
## Requirements
14+
* CakePHP 4.5
15+
* PHP 8.1+
16+
17+
## Installation
18+
19+
You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).
20+
21+
The recommended way to install composer package is:
22+
```
23+
composer require cakedc/cakephp-compress-cache
24+
```
25+
26+
Next, load the plugin by running the following command:
27+
```shell
28+
bin/cake plugin load CakeDC/CompressCache
29+
```
30+
31+
## Configuration
32+
33+
To configure the cache to use the Compressed Cache Engine, create a configuration similar to the one below in your `config/app.php` file. Include the configuration for your target cache engine in the wrapped key.
34+
```php
35+
// ...
36+
'Cache' => [
37+
// ...
38+
39+
'your_cache_configuration' => [
40+
'className' => \CakeDC\CompressCache\Cache\Engine\CompressEngine::class,
41+
'wrapped' => [
42+
'className' => \Cake\Cache\Engine\FileEngine::class,
43+
'prefix' => 'myapp_your_cache_configuration_',
44+
'path' => CACHE ,
45+
'serialize' => true,
46+
'duration' => '+1 years',
47+
'url' => env('CACHE_YOUR_CACHE_CONFIGURATION_URL', null),
48+
],
49+
'duration' => '+24 hours',
50+
],
51+
52+
// ...
53+
],
54+
// ...
55+
```
56+
57+
The Compressed Cache Engine will compress data before storing it in the cache and decompress it when reading it from the cache.

0 commit comments

Comments
 (0)