1 Running the Web Server
2 Scheme Servlets
3 Web Language Servlets
4 Configuration
5 Dispatchers
6 Web Config Unit
7 Web Server Unit
8 Continuation Managers
9 Internal
10 Troubleshooting
11 Acknowledgements
Index
On this page:
file-box?
file-box
file-unbox
file-box-set?
file-box-set!
Version: 4.0.2

 

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.