简体   繁体   English

是否可以在不同的PHP会话之间共享内存表?

[英]Is it possible to share a memory table between different PHP sessions?

For example with MySQL and PHP, when a memory table is created, it will be destroyed at the end of a session, meaning another user can't share and access the same memory table as the previous user. 例如,对于MySQL和PHP,创建内存表时,它将在会话结束时被销毁,这意味着另一个用户无法与前一个用户共享和访问相同的内存表。

Any solution for this? 有什么解决办法吗? (No HTML cache please :)) (请不要HTML缓存:))

MySQL MEMORY engine stores data in memory (RAM). MySQL MEMORY引擎将数据存储在内存(RAM)中。 It has nothing to do with what PHP process is connected to MySQL. 它与将PHP进程连接到MySQL无关。 It's MySQL ENGINE , therefore - if you connect to MySQL, you have access to data stored in MEMORY engine. 因此,它是MySQL ENGINE -如果您连接到MySQL,则可以访问存储在MEMORY引擎中的数据。 Once MySQL is rebooted, the data stored in MEMORY engine is lost. MySQL重新启动后,存储在MEMORY引擎中的数据将丢失。

On the other hand, there are temporary tables. 另一方面,有临时表。 Temporary tables are session based (based on MySQL session of course, not PHP one). 临时表是基于会话的(当然基于MySQL会话,而不是PHP会话)。 Once the session ends, the table is lost. 会话结束后,表将丢失。

Question is - what the heck are you trying to do and why are you constantly confusing naming? 问题是-您到底想做什么?为什么要不断混淆命名? Describe what you are aiming for with these past few questions and let more experienced people tell you straight what you need to do. 通过前面的几个问题描述您的目标,让经验丰富的人直接告诉您您需要做什么。

PHP has a variety of real good solutions to interchange data between scripts - like a text file, a database, an APC, memcache, nosql database. PHP具有各种真正好的解决方案,可以在脚本之间交换数据-例如文本文件,数据库,APC,内存缓存,nosql数据库。

It is great mystery to me, why there are always people who choose inappropriate tool and stubbornly trying to implement it despite of all obstacles and common sense. 对于我来说,这是一个很大的谜团,为什么总会有人选择不适当的工具,却不顾一切障碍和常识而顽固地尝试实施它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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