Skip to content

Commit fd4ed06

Browse files
committed
更新 README。
1 parent bbb5d80 commit fd4ed06

File tree

3 files changed

+95
-17
lines changed

3 files changed

+95
-17
lines changed

README.md

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,43 @@
11
# PD\Cache
22

3-
> PD\Cache is a hybrid caching system for PHP that combines Redis and filesystem caching with automatic fallback support. Provides seamless caching capabilities even when Redis is unavailable.
3+
> PD\Cache is a hybrid caching system for PHP that combines Redis and filesystem caching with automatic filesystem fallback support.
44
5-
![tag](https://img.shields.io/badge/tag-PHP%20Library-bb4444)
6-
![size](https://img.shields.io/github/size/pardnchiu/PHP-Cache/src/SQL.php)<br>
5+
![tag](https://img.shields.io/badge/tag-PHP%20Library-bb4444)
6+
![size](https://img.shields.io/github/size/pardnchiu/PHP-Cache/src/Cache.php)<br>
77
![version](https://img.shields.io/packagist/v/pardnchiu/cache)
88
![download](https://img.shields.io/packagist/dm/pardnchiu/cache)
99

1010
## Features
1111

1212
- Hybrid caching strategy (Redis + Filesystem)
1313
- Automatic fallback to filesystem when Redis is unavailable
14-
- Built-in content optimization for HTML/Text content
14+
- Built-in HTML / Text content optimization
1515
- Automatic cache expiration handling
1616
- Cache cleanup mechanism
1717
- MD5 key generation for cache entries
1818

1919
## Key Capabilities
2020

2121
- Get/Set cache with automatic storage selection
22-
- Content minification for HTML/Text
22+
- HTML/Text content minification
2323
- Automatic cache expiration
2424
- Cache cleanup for expired entries
25-
- Fallback mechanism for system resilience
25+
- System resilience fallback mechanism
2626

2727
## Dependencies
2828

2929
- `pardnchiu/redis` - For Redis caching support (optional)
30-
- `/storage/caches` - Write permission on storage directory
30+
- `/storage/caches` - Write permission on storage directory
3131

3232
## How to Use
3333

34-
### Install
34+
### Installation
3535

36-
```SHELL
36+
```shell
3737
composer require pardnchiu/cache
3838
```
3939

40-
```PHP
40+
```php
4141
// Initialize cache with Redis support
4242
$redis = new PD\Redis();
4343
$cache = new PD\Cache($redis);
@@ -63,14 +63,15 @@ This source code project is licensed under the [MIT](https://github.com/pardnchi
6363

6464
<img src="https://avatars.githubusercontent.com/u/25631760" align="left" width="96" height="96" style="margin-right: 0.5rem;">
6565

66-
<h4 style="padding-top: 0">邱敬幃 Pardn Chiu</h4>
66+
#### Pardn Chiu
6767

6868
<a href="mailto:dev@pardn.io" target="_blank">
69-
<img src="https://pardn.io/image/email.svg" width="48" height="48">
70-
</a> <a href="https://linkedin.com/in/pardnchiu" target="_blank">
71-
<img src="https://pardn.io/image/linkedin.svg" width="48" height="48">
69+
<img src="https://pardn.io/image/email.svg" width="48" height="48">
70+
</a>
71+
<a href="https://linkedin.com/in/pardnchiu" target="_blank">
72+
<img src="https://pardn.io/image/linkedin.svg" width="48" height="48">
7273
</a>
7374

74-
***
75+
---
7576

76-
©️ 2024 [邱敬幃 Pardn Chiu](https://pardn.io)
77+
©️ 2024 [Pardn Chiu](https://pardn.io)

README.zh.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# PD\Cache
2+
3+
> PD\Cache 是一個 PHP 混合式快取系統,結合了 Redis 和檔案系統快取,並具有檔案系統自動備用支援。
4+
5+
![tag](https://img.shields.io/badge/tag-PHP%20Library-bb4444)
6+
![size](https://img.shields.io/github/size/pardnchiu/PHP-Cache/src/Cache.php)
7+
![version](https://img.shields.io/packagist/v/pardnchiu/cache)
8+
![download](https://img.shields.io/packagist/dm/pardnchiu/cache)
9+
10+
## 特色功能
11+
12+
- 混合式快取策略(Redis + 檔案系統)
13+
- Redis 無法使用時自動切換至檔案系統
14+
- 內建 HTML / 文字內容最佳化
15+
- 自動快取過期處理
16+
- 快取清理機制
17+
- MD5 快取鍵值產生
18+
19+
## 核心功能
20+
21+
- 自動選擇儲存方式的快取讀寫
22+
- HTML/文字內容最小化
23+
- 自動快取過期
24+
- 過期項目快取清理
25+
- 系統彈性備用機制
26+
27+
## 相依套件
28+
29+
- `pardnchiu/redis` - Redis 快取支援(選用)
30+
- `/storage/caches` - 儲存目錄需要寫入權限
31+
32+
## 使用方式
33+
34+
### 安裝
35+
36+
```shell
37+
composer require pardnchiu/cache
38+
```
39+
40+
```php
41+
// 使用 Redis 支援進行初始化
42+
$redis = new PD\Redis();
43+
$cache = new PD\Cache($redis);
44+
45+
// 設定 1 小時過期的快取
46+
$cache->set("page-key", $content, 3600);
47+
48+
// 取得快取內容
49+
$content = $cache->get("page-key");
50+
51+
// 清理過期的快取項目
52+
$cache->clean();
53+
54+
// 不使用 Redis 初始化(僅檔案系統)
55+
$cache = new PD\Cache();
56+
```
57+
58+
## 授權條款
59+
60+
此原始碼專案採用 [MIT](https://github.com/pardnchiu/PHP-Cache/blob/main/LICENSE) 授權。
61+
62+
## 作者
63+
64+
<img src="https://avatars.githubusercontent.com/u/25631760" align="left" width="96" height="96" style="margin-right: 0.5rem;">
65+
66+
#### 邱敬幃 Pardn Chiu
67+
68+
<a href="mailto:dev@pardn.io" target="_blank">
69+
<img src="https://pardn.io/image/email.svg" width="48" height="48">
70+
</a>
71+
<a href="https://linkedin.com/in/pardnchiu" target="_blank">
72+
<img src="https://pardn.io/image/linkedin.svg" width="48" height="48">
73+
</a>
74+
75+
---
76+
77+
©️ 2024 [邱敬幃 Pardn Chiu](https://pardn.io)

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pardnchiu/cache",
3-
"description": "PD\\Cache is A hybrid caching system for PHP that combines Redis and filesystem caching with automatic fallback support.",
3+
"description": "PD\\Cache is a hybrid caching system for PHP that combines Redis and filesystem caching with automatic filesystem fallback support.",
44
"type": "library",
55
"license": "MIT",
66
"authors": [

0 commit comments

Comments
 (0)