{"size": 1177, "ext": "scrbl", "max_stars_repo_path": "web-server-doc/web-server/scribblings/file-box.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/file-box.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/file-box.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": 26.1555555556, "max_line_length": 72, "alphanum_fraction": 0.6482582838}
#lang scribble/doc
@(require "web-server.rkt")

@title[#:tag "lang/file-box"]{File Boxes}
@(require (for-label web-server/lang/file-box
                     racket/serialize))

@defmodule[web-server/lang/file-box]{

As mentioned earlier, it is dangerous to rely on the store in
Web Language servlets, due to the deployment scenarios available
to them. This module provides a simple API to replace
boxes in a safe way.

@defproc[(file-box? [v any/c])
         boolean?]{Checks if @racket[v] is a file-box.}

@defproc[(file-box [p path-string?]
                   [v serializable?])
         file-box?]{
 Creates a file-box that is stored at @racket[p], with the default
 contents of @racket[v].
}

@defproc[(file-unbox [fb file-box?])
         serializable?]{
 Returns the value inside @racket[fb]
}

@defproc[(file-box-set? [fb file-box?])
         boolean?]{
 Returns @racket[#t] if @racket[fb] contains a value.
}

@defproc[(file-box-set! [fb file-box?]
                        [v serializable?])
         void]{
 Saves @racket[v] in the file represented by @racket[fb].
}

@warning{If you plan on using a load-balancer, make sure your file-boxes
are on a shared medium.}

}
