BusyBird::StatusStorage::Memory - Simple status storage in the process memory
use BusyBird::StatusStorage::Memory; ## The statuses are stored in the process memory. my $storage = BusyBird::StatusStorage::Memory->new(); ## Load statuses from a file $storage->load("my_statuses.json"); ## Save the content of the storage into a file $storage->save("my_statuses.json");
This module is an implementation of BusyBird::StatusStorage.
This storage stores all statuses in the process memory. The stored statuses can be saved to a file in JSON format. The saved statuses can be loaded from the file.
This storage is rather for testing purposes. If you want a light-weight in-memory status storage, I recommend BusyBird::StatusStorage::SQLite.
This storage is synchronous, i.e., all operations block the thread and the callback is called before the method returns.
This module uses BusyBird::Log for logging.
Because this storage stores statuses in the process memory, forked servers cannot share the storage.
Because this storage stores statuses in the process memory, the stored statuses are lost when the process is terminated.
Creates the storage object.
You can specify the folowing options in %options.
%options
max_status_num
Specifies the maximum number of statuses the storage can store per timeline. If more statuses are added to a full timeline, the oldest statuses in the timeline are removed automatically.
In addition to the following methods, all methods described in BusyBird::StatusStorage are supported, too.
Saves the current content of the storage to the file named $filepath.
$filepath
In success, it returns true. In failure, it returns false and the error will be logged.
Loads statuses from the file named $filepath.
Toshio Ito <toshioito [at] cpan.org>
<toshioito [at] cpan.org>
To install BusyBird, copy and paste the appropriate command in to your terminal.
cpanm
cpanm BusyBird
CPAN shell
perl -MCPAN -e shell install BusyBird
For more information on module installation, please visit the detailed CPAN module installation guide.