Abstract
Most larger applications will sooner or later need some kind of persistence—the ability to save data to non-volatile storage (for example, your hard disk), so that it can outlive the program that created it. Whole libraries could be filled with the literature that has already been written about various aspects of persistence, and yet this chapter is comparatively short.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
See for example http://cliki.net/database .
- 2.
- 3.
Which can be installed with Quicklisp (see Recipe 18-2).
- 4.
This is like with JSON (see Recipe 19-11), where you also only read or write one object. And remember that this is also necessary to detect all circularities.
- 5.
You can also only call CL-STORE:RESTOREafter you’ve loaded the code to define the class and/or the package.
- 6.
Try (EQUALP *THING* *OTHER-THING*) in our example.
- 7.
But you can of course serialize their names.
- 8.
See https://www.sqlite.org/ .
- 9.
To connect to other databases, you usually need to provide authentication information like a username and a password. Search for connection specification in the CLSQL manual.
- 10.
- 11.
We won’t discuss these in detail. Most of them are more or less self-explanatory if you know SQL. The rest you’ll have to look up in the CLSQL manual.
- 12.
You’ll find a lot of good examples for it at https://sites.google.com/site/sabraonthehill/postmodern-examples .
- 13.
You might want to compare to the definition on page 665.
- 14.
It wouldn’t really be necessary to use BKNR.DATASTORE:MP-STORE here; BKNR.DATASTORE:STORE would suffice. BKNR.DATASTORE:MP-STORE is meant to serialize concurrent access to the store from multiple threads (see Chapter 11).
- 15.
By their class in this example. But there are, of course, better ways to do that. See what page 672 has to say about indices.
- 16.
The subsystem we used in our example provides snapshotting out of the box.
- 17.
Or, as an alternative, don’t quit your Lisp; just enter the new class definition, and then evaluate (BKNR.DATASTORE:RESTORE). That will also work.
- 18.
- 19.
Author information
Authors and Affiliations
Electronic Supplementary Material
Below is the link to the electronic supplementary material.
Rights and permissions
Copyright information
© 2016 Edmund Weitz
About this chapter
Cite this chapter
Weitz, E. (2016). Chapter 21: Persistence. In: Common Lisp Recipes. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1176-2_21
Download citation
DOI: https://doi.org/10.1007/978-1-4842-1176-2_21
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-1177-9
Online ISBN: 978-1-4842-1176-2
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)