I'm looking for a way to store information and things like anonymous functions to let them be available across requests, similar to how $_SESSION stores things, but not tied to any particular request or session.

有帮助吗?

解决方案

You can store your data into:

  • Databases
  • Caches (e.g. memcached)
  • Files (not really recommended, you should prefer databases)

What exactly is your usecase? For persistent data storage you should use a database, for some temporary things caches (as long as you need no guarantee that the data will not be deleted sometime).

For storing anonymous functions you have to serialize them first. To do so, see https://github.com/jeremeamia/super_closure or http://www.htmlist.com/development/extending-php-5-3-closures-with-serialization-and-reflection/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top