Skip to content

Commit 182cc22

Browse files
committed
first commit
0 parents  commit 182cc22

14 files changed

+2031
-0
lines changed

.gitattributes

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
* text=auto eol=lf
2+
3+
*.php text eol=lf
4+
*.md text eol=lf
5+
*.json text eol=lf
6+
7+
# Exclude from archives
8+
.gitattributes export-ignore
9+
.gitignore export-ignore
10+
examples/ export-ignore

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Dependencies
2+
/vendor/
3+
composer.lock
4+
5+
# IDE
6+
/.idea/
7+
/.vscode/
8+
*.swp
9+
*.swo
10+
*~
11+
12+
# OS
13+
.DS_Store
14+
Thumbs.db
15+
16+
# Testing
17+
/.phpunit.cache/
18+
.phpunit.result.cache
19+
20+
# Runtime
21+
*.log
22+
*.db
23+
*.db-shm
24+
*.db-wal
25+
/storage/
26+
27+
# Build artifacts
28+
/build/
29+
/dist/

CHANGELOG.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.0] - Unreleased
9+
10+
### Added
11+
- **PSR-16 SimpleCache compliance** - Full implementation of `Psr\SimpleCache\CacheInterface`
12+
- `DateInterval` support for TTL values (PSR-16 standard)
13+
- `setMultiple()` method for batch setting (PSR-16)
14+
- `getMultiple()` method for batch retrieval (PSR-16)
15+
- `deleteMultiple()` method for batch deletion (PSR-16)
16+
- Simple key/value storage with SQLite
17+
- TTL support for automatic expiration
18+
- Atomic increment/decrement operations
19+
- Transaction support
20+
- WAL mode for better concurrency
21+
- Chunk processing for large datasets
22+
- Database statistics via `stats()`
23+
- Garbage collection for expired keys via `cleanExpired()`
24+
- `pull()` method for get-and-delete operation
25+
- Multiple examples demonstrating usage
26+
- Comprehensive documentation
27+
28+
### Changed
29+
- **BREAKING**: `forget()` renamed to `delete()` (PSR-16 standard)
30+
- **BREAKING**: `flush()` renamed to `clear()` (PSR-16 standard)
31+
- **BREAKING**: `setMany()` renamed to `setMultiple()` (PSR-16 standard)
32+
- **BREAKING**: `many()` renamed to `getMultiple()` (PSR-16 standard)
33+
- `set()` now returns `bool` instead of `void` (PSR-16 compliance)
34+
- `delete()` now returns `bool` instead of `void` (PSR-16 compliance)
35+
- `clear()` now returns `bool` instead of `void` (PSR-16 compliance)
36+
- TTL parameter now accepts `int|DateInterval|null` instead of just `int|null`
37+
38+
### Fixed
39+
- TTL handling with value 0 (now correctly treated as "already expired")
40+
- Optimized `has()` method to avoid unnecessary JSON decoding
41+
- Batch deletion of expired keys in `all()` method
42+
43+
### Security
44+
- Table name sanitization to prevent SQL injection
45+
- Value size validation (max 10MB recommended)
46+
- Proper key validation in batch operations
47+
48+
## Migration Guide from Pre-1.0
49+
50+
If you're upgrading from a pre-PSR-16 version, update your code as follows:
51+
52+
```php
53+
// Before
54+
$cache->forget('key');
55+
$cache->flush();
56+
$cache->setMany(['key' => 'value']);
57+
$values = $cache->many(['key1', 'key2']);
58+
59+
// After (PSR-16 compliant)
60+
$cache->delete('key');
61+
$cache->clear();
62+
$cache->setMultiple(['key' => 'value']);
63+
$values = $cache->getMultiple(['key1', 'key2']);
64+
```
65+
66+
All other methods (`get`, `has`, `increment`, `decrement`, `pull`, `all`, `keys`, `transaction`, `chunk`, `cleanExpired`, `stats`) remain unchanged.

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 Mário Aragão
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.

0 commit comments

Comments
 (0)