I have a signup page.

我有一个注册页面。

On this page, user input values are checked asynchronously by a php backend against tables.

在此页面上,用户输入值由php后端针对表异步检查。

My problem is that data model objects are fairly large; would it be wise to start a session via ajax when someone enters the page (onload), which caches the model objects so that all other ajax requests from that client don't end up recreating the data model objects every request. Then when the user navigates away from the page (onunload or whatever) an ajax request is send the destroy the session.

我的问题是数据模型对象相当大;当某人进入页面(onload)时,通过ajax启动会话是明智的,该页面缓存模型对象,以便来自该客户端的所有其他ajax请求最终不会在每次请求时重新创建数据模型对象。然后,当用户离开页面(onunload或其他)时,发送ajax请求会销毁会话。

It seems a good idea to me because every asynchronous request made as a result of a user interaction with the form doesn't recreate all the objects that have been created before hand.

对我来说这似乎是一个好主意,因为用户与表单交互而产生的每个异步请求都不会重新创建事先创建的所有对象。

Would this work in practice?

这会在实践中发挥作用吗?

(for details of my worries see comments)

(有关我担心的详细信息,请参阅评论)

UPDATE:

The main issue raised is that it will create a dangling session. Could this be fixed by putting just a simple 5 minute timeout on the session?

提出的主要问题是它将创建一个悬空会议。可以通过在会话上放置一个简单的5分钟超时来解决这个问题吗?

1 个解决方案

#1


0

For anyone wondering, this proved to be an unbearably horrible idea. it was alright in principle but managing all the sessions and making sure everything stays synchronous with the front end was near impossible and in no way scalable, which in turn made my controller structure so complicated that it was a nightmare to debug (not to mention I had to clear my browser cache every time I updated the development repo.. ). it managed to wasted a lot of my time and caused me to miss some crucial deadlines and ultimately was a massive effort for what was really a tiny overhead.

对于任何想知道的人来说,这被证明是一个难以忍受的可怕想法。它在原则上是正常的,但是管理所有会话并确保所有会话与前端保持同步几乎是不可能的,并且无法扩展,这反过来又使我的控制器结构变得如此复杂,以至于它是调试的噩梦(更不用说我了)我每次更新开发回购时都必须清除浏览器缓存...)。它设法浪费了我很多时间,导致我错过了一些关键的最后期限,最终是一个巨大的努力,真正的微不足道的开销。

Please don't try this.

请不要试试这个。

更多相关文章

  1. 如何通过PHP将HTML页面作为字符串获取?
  2. 在通过AJAX响应发送的页面上执行javascript函数
  3. 使用jQuery和ajax更改浏览器地址栏URL,无需重载页面[重复]
  4. 键入提示 - 指定对象数组
  5. PHP 创建对象的两种方法
  6. 阅读使用JavaScript生成的页面
  7. PHP教程之PHP调用session_start后页面始终加载的问题研究
  8. jQuery ajax调用不会调用我的php页面
  9. 使用安全的会话-cookie在HTTP和HTTPS页面之间切换

随机推荐

  1. RK3288 Android 7.1 屏蔽“您的设备内部
  2. android中基于网络和GPS的不同精度定位
  3. Android AppWidget系统框架
  4. Mac Yosemite下Android Studio环境问题集
  5. Android 中文 API (36) —— Toast
  6. Android 中Activity,Window和View之间的
  7. eclipse android安装
  8. android framework 层服务 分析
  9. Android开发之GridView属性介绍
  10. mac 安装Android studio遇到的问题及解决