Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A manipulable, pluggable, memoization framework for Clojure

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.md

clojure.core.memoize - A Clojure Memoization Library

core.memoize is a new Clojure contrib library providing the following features:

  • An underlying PluggableMemoization protocol that allows the use of customizable and swappable memoization caches that adhere to the synchronous CacheProtocol found in core.cache

  • Memoization builders for implementations of common caching strategies, including:

    • First-in-first-out (memo-fifo)
    • Least-recently-used (memo-lru)
    • Least-used (memo-lu)
    • Time-to-live (memo-ttl)
    • Naive cache (memo) that duplicates the functionality of Clojure's memoize function
  • Functions for manipulating the memoization cache of core.memoize backed functions

core.memoize is based on a library named Unk, found at http://github.com/fogus/unk that is planned for deprecation.

Usage

You can use core.memoize in your Leiningen and Cake projects with the following :dependencies directive in your project.clj file:

[org.clojure/core.memoize "0.5.1"]

For Maven-driven projects, use the following slice of XML in your pom.xml's <dependencies> section:

<dependency>
  <groupId>org.clojure</groupId>
  <artifactId>core.memoize</artifactId>
  <version>0.5.1</version>
</dependency>

Enjoy!

Places

Changes from Unk

The v0.5.1 version of core.memoize is based almost wholly on the final version of Unk, with the following changes:

  • All cache factory functions have been moved to core.cache
  • The SoftCache backed implementation was buggy and removed for now

Plans

The following capabilities are under design, development, or consideration for future versions of core.memoize:

  • LIRS backed memoization
  • A defn-memo macro
  • A MapMaker style ctor interface
  • Reimplementation of a cache based on soft references
  • test.generative usage
  • Deprecation of Unk
  • Documentation and examples

More planning is needed around capabilities not listed nor thought of.

License

Copyright Rich Hickey, Stuart Halloway, and contributors.

Licensed under the EPL. (See the file epl.html.)

Something went wrong with that request. Please try again.