Right now some variables (like the cache expiry key) are shared between the get and set functions. A sensible way to share these must be thought of.
Example: Right now a global currentCacheKey variable exists and is used by both middleware functions. As there is only one it is overwritten by every call to the setter. This might not be desirable when using the middleware on specific routes instead of the application controller.
Furthermore options could be passed in just the beforeAction/get middleware. The get middleware could then pass it along to the set middleware via the request object (as it already does for the key).
Right now some variables (like the cache expiry key) are shared between the get and set functions. A sensible way to share these must be thought of.
Example: Right now a global
currentCacheKey
variable exists and is used by both middleware functions. As there is only one it is overwritten by every call to the setter. This might not be desirable when using the middleware on specific routes instead of the application controller.Furthermore options could be passed in just the beforeAction/get middleware. The get middleware could then pass it along to the set middleware via the request object (as it already does for the key).