steveklabnik / request_store

Per-request global storage for Rack.
https://github.com/steveklabnik/request_store
MIT License
1.47k stars 87 forks source link

Document that clear_all! is dangerous #67

Open fsateler opened 4 years ago

fsateler commented 4 years ago

The documentation of clear! and clear_all are quite similar:

Public: Removes all the request-local variables

Public: Clears all the request-local variable stores

However, clear_all! is something you almost never want to call: it immediately destroys the information that may be in use by other threads.

It would be nice to document this. Maybe something along the lines of:

clear! Removes all the request-local variables for the current request. This method will clear the local storage for the currently executing request.

clear_all! Clears all the request-local variable stores. This method will clear the local storage for all requests. This method should not be called during normal operation as it will destroy the storage of unrelated threads.