Update : @bejibun/core v0.4.23
Counter & Numeric Value Utilities
This release introduces built-in helpers for managing counters and numeric values across Redis and Cache drivers.
---
Redis Utilities
Added new Redis helper methods :
- Added `.exists()` Check whether a key exists
- Added `.incr()` Increment a numeric value by 1
- Added `.decr()` Decrement a numeric value by 1
- Added `.incrBy()` Increment a numeric value by a specified amount
- Added `.decrBy()` Decrement a numeric value by a specified amount
Example :
await Redis.exists("visitors");
await Redis.incr("visitors");
await Redis.decr("visitors");
await Redis.incrBy("visitors", 10);
await Redis.decrBy("visitors", 5);
---
Cache Utilities
Added atomic cache counter operations :
- Added `.incrementBy()` Increment a numeric value by a specified amount
- Added `.decrementBy()` Decrement a numeric value by a specified amount
Example :
await Cache.incrementBy("cache-key", 10);
await Cache.decrementBy("cache-key", 5);
These helpers eliminate the need for manual read-modify-write operations and provide a cleaner API for working with numeric values.
github.com/Bejibun-Framework…