Clockwork stores the collected data in a persistent manner.
By default we use a flat JSON file storage implementation and we also include an optional SQL storage implementation. To learn how to use included implementation see the "advanced metadata storage" section.
While in most cases you will want to use one of the included options, you can write a custom one (eg. using Redis or unsupported SQL database).
To create a storage implementation you will need to implement the
Clockwork\Storage\StorageInterface interface, though it's recommended to extend the
Clockwork\Storage\Storage base class instead.
The interface contains a bunch of methods for reading requests, a save and a cleanup method. All read methods should return either single or an array of
all()returns all stored requests
find($id)returns a single request with specified ID or null
latest()returns a single latest request or null
previous($id, $count = null)returns an array of requests received before specified ID, optionally limited to specified count
next($id, $count = null)returns an array of requests received after specified ID, optionally limited to specified count
store(Request $request)store the request
cleanup()clean up old requests, the algorithm is up to you
To use the custom storage implementation we need to set it on the main Clockwork class:
Feel free to take a look at existing storage implementations for inspiration.