Skip to main content

Chapter 21: Persistence

  • Chapter
Common Lisp Recipes
  • 2026 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 79.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 99.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    See for example http://cliki.net/database .

  2. 2.

    See https://en.wikipedia.org/wiki/ACID .

  3. 3.

    Which can be installed with Quicklisp (see Recipe 18-2).

  4. 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. 5.

    You can also only call CL-STORE:RESTOREafter you’ve loaded the code to define the class and/or the package.

  6. 6.

    Try (EQUALP *THING* *OTHER-THING*) in our example.

  7. 7.

    But you can of course serialize their names.

  8. 8.

    See https://www.sqlite.org/ .

  9. 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. 10.

    See https://www.sqlite.org/cli.html .

  11. 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. 12.

    You’ll find a lot of good examples for it at https://sites.google.com/site/sabraonthehill/postmodern-examples .

  13. 13.

    You might want to compare to the definition on page 665.

  14. 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. 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. 16.

    The subsystem we used in our example provides snapshotting out of the box.

  17. 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. 18.

    See https://en.wikipedia.org/wiki/B-tree .

  19. 19.

    See https://en.wikipedia.org/wiki/Berkeley_DB .

Author information

Authors and Affiliations

Authors

Electronic Supplementary Material

Below is the link to the electronic supplementary material.

chapter-21 (zip 2 kb)

Rights and permissions

Reprints 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

Publish with us

Policies and ethics