{"size": 1314, "ext": "scrbl", "max_stars_repo_path": "web-server-doc/web-server/scribblings/cache-table.scrbl", "max_stars_repo_name": "jessealama/web-server", "max_stars_repo_stars_event_min_datetime": "2015-01-21T08:11:58.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-20T08:28:39.000Z", "max_issues_repo_path": "web-server-doc/web-server/scribblings/cache-table.scrbl", "max_issues_repo_name": "jessealama/web-server", "max_issues_repo_issues_event_min_datetime": "2015-01-14T08:06:37.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-12T14:38:40.000Z", "max_forks_repo_path": "web-server-doc/web-server/scribblings/cache-table.scrbl", "max_forks_repo_name": "jessealama/web-server", "max_forks_repo_forks_event_min_datetime": "2015-03-05T15:07:36.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-30T18:59:25.000Z"}
{"max_stars_count": 82, "max_issues_count": 105, "max_forks_count": 37, "avg_line_length": 29.2, "max_line_length": 79, "alphanum_fraction": 0.6179604262}
#lang scribble/doc
@(require "web-server.rkt")

@title[#:tag "cache-table"]{Cache Table}
@(require (for-label web-server/private/cache-table))

@defmodule[web-server/private/cache-table]{

This module provides a set of caching hash table
functions.

@defproc[(make-cache-table)
         cache-table?]{
 Constructs a cache-table.
}

@defproc[(cache-table-lookup! [ct cache-table?]
                              [id symbol?]
                              [mk (-> any/c)])
         any/c]{
 Looks up @racket[id] in @racket[ct]. If it is not present, then @racket[mk] is
 called to construct the value and add it to @racket[ct].
}

@defproc[(cache-table-clear! [ct cache-table?]
                             [entry-ids (or/c false/c (listof symbol?)) #f]
			     [finalize (-> any/c void?) void])
         void?]{
 If @racket[entry-ids] is @racket[#f], clears all entries in @racket[ct].
 Otherwise, clears only the entries with keys in @racket[entry-ids].
 The procedure @racket[finalize] is invoked on each entry before it is cleared.

 @history[#:changed "1.3"
          "Added optional argument for list of entry keys."
          #:changed "1.3"
          "Added optional argument for finalizer procedure."]
}

@defproc[(cache-table? [v any/c])
         boolean?]{
 Determines if @racket[v] is a cache table.
}

}
