Giter Site home page Giter Site logo

core.memoize's Introduction

clojure.core.memoize

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 (clojure.core.memoize/fifo)
    • Least-recently-used (clojure.core.memoize/lru)
    • Least-used (clojure.core.memoize/lu)
    • Time-to-live (clojure.core.memoize/ttl)
    • Naive cache (memo) that duplicates the functionality of Clojure's memoize function
  • Functions for manipulating the memoization cache of core.memoize backed functions

Releases and Dependency Information

Latest stable release: 0.5.8

Leiningen dependency information:

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

Maven dependency information:

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

Example Usage

    (ns my.cool.lib
      (:require clojure.core.memoize))

    (def id (clojure.core.memoize/lu 
	          #(do (Thread/sleep 5000) (identity %)) 
			  :lu/threshold 3))

    (id 42)
    ; ... waits 5 seconds
    ;=> 42

    (id 42)
    ; instantly
    ;=> 42

Refer to docstrings in the clojure.core.memoize namespace for more information.

Developer Information

Change Log

  • Release 0.5.8 on 2015.11.06
  • Release 0.5.7 on 2015.01.12
  • Release 0.5.6 on 2013.06.28
    • Added optional args to memo-clear!.
    • Widened contract on factory functions to accept any callable.
  • Release 0.5.5 on 2013.06.14
    • Deprecated memo-* APIs
    • Adds new API of form (cache-type function <base><:cache-type/threshold int>)
  • Release 0.5.4 on 2013.06.03
  • Release 0.5.3 on 2013.03.18
    • Works with core.cache v0.6.3
  • Release 0.5.2 on 2012.07.13
    • Works with core.cache v0.6.1
  • Release 0.5.1 on 2011.12.13
    • Removed SoftCache memoization
  • Release 0.5.0 on 2011.12.13
    • Rolled in basis of Unk

Copyright and License

Copyright (c) Rich Hickey and Michael Fogus, 2012, 2013. All rights reserved. The use and distribution terms for this software are covered by the Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound bythe terms of this license. You must not remove this notice, or any other, from this software.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.