On Thu, 2002-09-05 at 13:10, Jeff Jones wrote: > Hello JCS users and developers, > > > I just put our first JCS enabled site up to production and the pages > using the cache are loading *much* faster. Thanks for making JCS! > > I have some questions as to the 'right way' to do some things in JCS. > > > A) Currently, I am putting Torque objects into the cache. Is this bad? > Are they serializable?
The usual parent object o.a.t.om.BaseObject is Serializable, though it is possible to configure torque so that you are using a different base class in which case the objects may not be Serializable. > > I suppose it would be 'cleaner' to write a Bean to represent every > cached entity in my system instead of using Torque objects, and then put > the Beans in the cache, but it just seems like more work and QA. Plus, > when I get a Torque object in-hand, I allow the .vm to traverse as much > of the data tree it needs to display what it wants to show (with the > built-in torque accessors). It's so convenient. > > Note that this causes my JCS cache to continually grow (and also get > faster), as the Torque objects themselves cache things they load. > > > B) What's the best way to keep the results of different groupings of the > same/similar objects in the cache. > > For example, I have a set of Customer objects that are grouped many > different ways for display on our website. For example, on some pages > the active customers are listed alphabetically, on others I show a few > of them at random, and on another they're shown by category. On yet > other pages, I only show a subset of them based on different criteria. > > Currently this is all handled by different selects straight from the > database, which I want to avoid. > > Right now I'm putting lists and maps in the cache for each grouping, > like 'AllCustomers', 'Advertisers', 'CustomersByAlphabet', etc. This > means, however, that whenever anyone adds or removes an object from the > CustomerCache, or there is a cache miss, I rebuild all these lists > (which takes about 3-4 seconds). I also only want one instantiation of > each entity actually in the cache at any time, even if it's pointed to > by different groups. > > I believe the 'groups' feature in JCS is supposed to help with this, but > I've seen messages that that's not ready for prime time. Also, the > correct way to use the groups wasn't obvious enough for me to try that > right out of the gate. Any comments or code samples out there? Torque uses jcs and the groups feature. I recently (is a couple months recent?) went through and stripped down the groups to be basically a way to allow invalidation of several cache elements at once on demand (not by synchronizing timeouts). I would describe it as usuable. john mcnally -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
