<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Mutable value objects - single user use of ehcache"]]></title>
		<link>http://forums.terracotta.org/forums/posts/list/16.page</link>
		<description><![CDATA[Latest messages posted in the topic "Mutable value objects - single user use of ehcache"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Mutable value objects - single user use of ehcache</title>
				<description><![CDATA[ 
Hi,

What is the expected behaviour for ehcache with mutable value objects, where the cache is persisted to disk?
There is no clustering here, just a simple single JVM using ehcache.

Our code does something like this:
1. create a cache
2. create a mutable serializable object - call it Value
3. put it into the cache under a particular key
4. wait for a few seconds
5. update the data within Value using setter methods

We only do the "put" once.
Should the Value written to disk be that from step 3 or step 5?

Under an older ehcache release (1.6.0-beta2), the write to disk was delayed until CacheManager.shutdown time.
Under the newer ehcache release (2.5.1), the write to disk is done almost immediately.

I have demo code and stack traces of the write points if you need them.
I can fix our application by doing a "re-put" when the mutable object changes.

What's the expected behaviour of ehcache here?

Thanks in advance,

Connor Sadler
]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7370.page#36247</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7370.page#36247</link>
				<pubDate><![CDATA[Fri, 17 Aug 2012 07:01:30]]> GMT</pubDate>
				<author><![CDATA[ connors]]></author>
			</item>
			<item>
				<title>Re:Mutable value objects - single user use of ehcache</title>
				<description><![CDATA[ I believe in the older versions of Ehcache, you had to call cache.flush() or the shutdown to send the data to disk.

The newer versions do it automatically. 

Take a look at Ehcache 2.6.0. It comes with a new restartable store. It is faster than the older versions and if your server crashes, the data will still be on disk.

I hope this helps.]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7370.page#36249</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7370.page#36249</link>
				<pubDate><![CDATA[Fri, 17 Aug 2012 10:40:09]]> GMT</pubDate>
				<author><![CDATA[ ericm]]></author>
			</item>
			<item>
				<title>Re:Mutable value objects - single user use of ehcache</title>
				<description><![CDATA[ 
Thanks for the reply.
Given that information, I'm gathering it's best not to cache an object then mutate it?
It sounds like this won't work with newer versions of ehcache.

]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7370.page#36257</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7370.page#36257</link>
				<pubDate><![CDATA[Mon, 20 Aug 2012 04:21:46]]> GMT</pubDate>
				<author><![CDATA[ connors]]></author>
			</item>
			<item>
				<title>Re:Mutable value objects - single user use of ehcache</title>
				<description><![CDATA[ Users mutate cached objects all the time. Thats the purpose its for. Not sure I understand your scenario here.]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7370.page#36259</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7370.page#36259</link>
				<pubDate><![CDATA[Mon, 20 Aug 2012 05:52:13]]> GMT</pubDate>
				<author><![CDATA[ klalithr]]></author>
			</item>
			<item>
				<title>Re:Mutable value objects - single user use of ehcache</title>
				<description><![CDATA[ 
How do you mean they "mutate them all the time" ?
Do people generally change data inside value object instances after a put?
Or do you mean they put a brand new object under the same key?

The whole scenario is above, I don't know how to explain it further.
I can provide some code if that would help.

I think I may already have the answer to my question, though - ehcache will write to disk ASAP now so later object mutations will be lost.

Regards,

Connor
]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7370.page#36260</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7370.page#36260</link>
				<pubDate><![CDATA[Mon, 20 Aug 2012 07:37:56]]> GMT</pubDate>
				<author><![CDATA[ connors]]></author>
			</item>
			<item>
				<title>Re:Mutable value objects - single user use of ehcache</title>
				<description><![CDATA[ I think what you mean is that Ehcache will write objects to disk as they are put or replaced. So disk will always have the most recent objects.

Is that the behavior you are looking for?

]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7370.page#36262</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7370.page#36262</link>
				<pubDate><![CDATA[Mon, 20 Aug 2012 08:17:15]]> GMT</pubDate>
				<author><![CDATA[ ericm]]></author>
			</item>
			<item>
				<title>Re:Mutable value objects - single user use of ehcache</title>
				<description><![CDATA[ 
I am not looking for any behaviour.
I am asking, whats the expected behaviour?

I think the answer is given by what the current version of Ehcache does, so I'll leave it there.

Thanks for your input.

Regards,

Connor
]]></description>
				<guid isPermaLink="true">http://forums.terracotta.org/forums/posts/list/7370.page#36272</guid>
				<link>http://forums.terracotta.org/forums/posts/list/7370.page#36272</link>
				<pubDate><![CDATA[Tue, 21 Aug 2012 02:36:10]]> GMT</pubDate>
				<author><![CDATA[ connors]]></author>
			</item>
	</channel>
</rss>