简体   繁体   中英

Ruby Singleton and Shotgun

Im starting with Ruby and our team leader sends us to learn Sinatra, reloading the application changes is been done by Shotgun, my problem now is that i have a Singleton entity which i would love to keep states between request, but aparently Shotgun restarts is every request.

Any Help or Explanation on this would be apreciated,

Thanks in advance.

除非您将应用程序的状态保存在会话数据中,否则您根本不希望在请求之间保存任何有关应用程序状态的信息(无论是否是“猎枪”)。

For sessions to persist with Shotgun you need to set the key... Otherwise it is reset with every page load.

enable :sessions
set :session_secret, "yourKey" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM