stassats-storage is a CLOS ObjectStore.

Depends on: alexandria, closer-mop, ieee-floats


License: public domain

Quick assessment (2023-06-25)

(defvar *storage* (make-instance 'storage:storage :file "test.db")) (defclass person (storage:identifiable) ((name :accessor person-name :initarg :name) (email :accessor person-email :initarg :email)) (:metaclass storage:storable-class))

The class needs to be attached to the storage object:

> (pushnew (find-class 'person) (storage:storage-data *storage*)) (#<The STORAGE:STORABLE-CLASS PERSON 77269440>)

Then add an object to the store:

> (storage:add (make-instance 'person :name "Test Dummy" :email "test@localhost")) #<a PERSON 77348416>

Querying gives the expected result:

> (storage:objects-of-type 'person) (#<a PERSON 77348416>)

And to save the database:

> (storage:save-data *storage*) T

Likewise, the storage:load-data function will restore the same database.