Is Rails shared-nothing or can separate requests access the same runtime variables?

后端 未结 4 762
囚心锁ツ
囚心锁ツ 2020-12-05 07:48

PHP runs in a shared-nothing environment, which in this context means that every web request is run in a clean environment. You can not access another request\'s data excep

4条回答
  •  一整个雨季
    2020-12-05 08:04

    In your average deployment using Passenger, you probably have multiple app processes that share nothing between them but classes within each process that maintain their (static) state from request to request. Each request, though, makes a new instance of your controllers.

    You might call this a cluster of distinct shared-state environments.

    To use your Java analogy, you can do the caching and have it work from request to request, you just can't assume that it will be available on every request.

提交回复
热议问题