On this page:
file-box?
file-box
file-unbox
file-box-set?
file-box-set!
Version: 4.1

3.7 File Boxes

 (require 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. "lang/file-box.ss" provides a simple API to replace boxes in a safe way.

(file-box? v)  boolean?

  v : any/c

Checks if v is a file-box.

(file-box p v)  file-box?

  p : path?

  v : serializable?

Creates a file-box that is stored at p, with the default contents of v.

(file-unbox fb)  serializable?

  fb : file-box?

Returns the value inside fb

(file-box-set? fb)  boolean?

  fb : file-box?

Returns #t if fb contains a value.

(file-box-set! fb v)  void

  fb : file-box?

  v : serializable?

Saves v in the file represented by fb.

Warning:If you plan on using a load-balancer, make sure your file-boxes are on a shared medium.