It s going to be tough, because as stated in one of your earlier questions, the CLIENT scope cannot fully emulate the SESSION scope, for the simple fact that it can only include simple vars. You can t store a Structure in CLIENT for example.
但是,这些简单的变式类型之一是一种扼杀。
因此,从理论上讲,如果要设法将复杂的数据结构编成一个星体,它就可以发挥作用。
幸运的是,您有一个机制:<CFWDDX>
。
<cfset data = StructNew() />
<cfset data.name = "Dale" />
<cfset data.type = "CF Programmer" />
<cfwddx action="cfml2wddx" input="#data#" output="serial" />
<cfset CLIENT.data = serial />
If you glance at your CLIENT.data var (serial) you ll see it looks something like:
<wddxPacket version= 1.0 ><header/><data><struct><var name= TYPE ><string>CF Programmer</string></var><var name= NAME ><string>Dale</string></var></struct></data></wddxPacket>
牢记,这并不是要努力找到所有解决办法。 你无法将氟氯化碳序列化。 还忆及对厨师的大小限制(在有些配置中,可以实际储存生物浓缩变量),因此你有机会从非常庞大的数据结构中丢失数据。
You could wrap this serialization/de-serialization in a CFC that you house in the application scope, as you suggest above. The convenience here with <CFWDDX>
is that it is a one-size-fits-all for Structures, Arrays, and all the other types as well.
Maybe not a very robust or long-term solution, but might point you in the right direction.