PHPackages                             carloshb/cache-service - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. carloshb/cache-service

ActiveLibrary[Caching](/categories/caching)

carloshb/cache-service
======================

Simple cache service using SQLite to reduce multiple db queries

0.2.1(8y ago)220[1 issues](https://github.com/carloshskp/cache-service/issues)MITPHPPHP &gt;=7.0

Since May 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/carloshskp/cache-service)[ Packagist](https://packagist.org/packages/carloshb/cache-service)[ RSS](/packages/carloshb-cache-service/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (4)Used By (0)

carloshb/cache-service
======================

[](#carloshbcache-service)

[![Latest Stable Version](https://camo.githubusercontent.com/943daf49a8cb3fc366480ce933ff34e1f61fcc6835d150c7c748eb45c9546c8f/68747470733a2f2f706f7365722e707567782e6f72672f6361726c6f7368622f63616368652d736572766963652f762f737461626c65)](https://packagist.org/packages/carloshb/cache-service)[![Total Downloads](https://camo.githubusercontent.com/6ffdc104152974c49bc252859c93a967f7b4b3085a6f57c742be40b00ffd6532/68747470733a2f2f706f7365722e707567782e6f72672f6361726c6f7368622f63616368652d736572766963652f646f776e6c6f616473)](https://packagist.org/packages/carloshb/cache-service)[![Latest Unstable Version](https://camo.githubusercontent.com/2f8b373071c68e18539886ce5ea69a509323a213ca7b52f6d2b83c01249e2460/68747470733a2f2f706f7365722e707567782e6f72672f6361726c6f7368622f63616368652d736572766963652f762f756e737461626c65)](https://packagist.org/packages/carloshb/cache-service)[![License](https://camo.githubusercontent.com/9ae66089fd99ec878e62143e1f6269a085aa3a7fda3c325076d6f40726526f54/68747470733a2f2f706f7365722e707567782e6f72672f6361726c6f7368622f63616368652d736572766963652f6c6963656e7365)](https://packagist.org/packages/carloshb/cache-service)

Simple cache service using SQLite to reduce multiple db queries.

Basic information
-----------------

[](#basic-information)

- **default cache time**: 60mins
- **default cache path**: Carloshb\\CacheService\\Driver

How to install?
---------------

[](#how-to-install)

Install using composer

```
composer require carloshb/cache-service 0.2.*
```

Or clone in or project.

### How to change default configs?

[](#how-to-change-default-configs)

Add PHP env:

```
    $_ENV['cache_time'] = 10; // minutes
    $_ENV['cache_path'] = 'yor/storage/path';
```

Usage
-----

[](#usage)

### resolve(string $key, callable $callback \[, int $time = 60\]) : Cache

[](#resolvestring-key-callable-callback--int-time--60--cache)

The method **resolve()** returns an instance of Cache class and generate or update the key sent with the callback return. First parameter is the key, a string. Second parameter is the callback, a function returning array with expected results. Third parameter is optional, for set *n* minutes for cache.

```
    $cache = new \Carloshb\CacheService\Cache();
    $cache->resolve('getInfo', function(){
        return array(
            'name' => 'Carlos Henrique Bernardes',
            'email' => 'contato@carloshb.com.br'
        );
    });
```

### getCacheContent() : json

[](#getcachecontent--json)

Use after **resolve()** to get a content of cache, the method returns a json.

```
    $cache = new \Carloshb\CacheService\Cache();
    $content = $cache->resolve('getInfo', function(){
        return array(
            'name' => 'Carlos Henrique Bernardes',
            'email' => 'contato@carloshb.com.br'
        );
    })->getCacheContent();
```

### destroy(string $key) : bool

[](#destroystring-key--bool)

Use this method to force cache destroy using the key name.

```
    $cache = new \Carloshb\CacheService\Cache();
    $response = $cache->destroy('getInfo');
    var_dump($response); // true or false
```

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Total

2

Last Release

3273d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ef51a850b32140e0ca3db0fdfb16fb5c5fd04079129ceab4e656f468763d7538?d=identicon)[carloshb](/maintainers/carloshb)

---

Top Contributors

[![carloshskp](https://avatars.githubusercontent.com/u/5603002?v=4)](https://github.com/carloshskp "carloshskp (19 commits)")

---

Tags

cachelibraryphp7sqlite3

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/carloshb-cache-service/health.svg)

```
[![Health](https://phpackages.com/badges/carloshb-cache-service/health.svg)](https://phpackages.com/packages/carloshb-cache-service)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
