radiate-framework / framework

A WordPress plugin and theme framework
https://radiate-framework.github.io/
MIT License
4 stars 0 forks source link

Cache improvements #92

Closed BenRutlandWeb closed 3 years ago

BenRutlandWeb commented 3 years ago

Is your feature request related to a problem? Please describe. Getting multiple values from the cache involves lots of copy pasta.

Describe the solution you'd like Methods to get/set multiple cache values Cache::many() etc.

Describe alternatives you've considered Loops are a bit ugly.

Additional context Laravel has (poorly documented) multiple methods to handle many cache keys. many, putMany

The ability to add a prefix to cache keys would also be cool:

Cache::prefix('users')->putMany([
  'ben'   => User::find(1), // users.ben
  'jerry' => User::find(2), // users.jerry
]);

$ben = Cache::get('users.ben');
$jerry = Cache::prefix('users')->get('jerry');
BenRutlandWeb commented 3 years ago

Reopened as the prefix idea wasn't implemented

BenRutlandWeb commented 3 years ago

To be consistent with Laravel, the cache prefix should be set in the config rather than when calling the class

BenRutlandWeb commented 3 years ago

Reopened until the config has been implemented.