I have a webscript in alfresco that does something simple: reads a property, and based on its value, creates a json response. Another webscript is in charge of updating this property. However, the response from the original script is sometimes cached, and not for all clients.
So, for one client, I get a current status, and for the other I get the开发者_运维知识库 previous state.
The webscript basically reads a property from a node (nodeRef was sent in webscript request):
var status = doc.properties["my:customProp"];
switch (status) {
case "something":
model.prop = "FirstResponse";
break;
case "somethingElse":
model.prop = "SecondResponse";
break;
default:
model.prop = "ThirdResponse";
}
The freemarker template then parses the prop and creates a json output for the response.
Now, this should be simple and straightforward. The use case is as follows: 1. When a user #1 first gets to the doc, the status was set to "something". He got a "FirstResponse", and with a webscript he changed it.
When he then get the document again, he gets the second response.
But if a second client accesses this same node and asks for the response, it still gets the first response, and even more, when I try to read that prop, I get the "old" prop.
So I'm refreshing the script from two clients and reading this property, one client gets one value, the other gets another value.
My only guess (so far) is that this is a caching issue. So, how do I prevent caching? And where did it happen? Hibernate? Some sort of repository cache? How to get rid of it?
check http://wiki.alfresco.com/wiki/Web_Scripts#cache
Well, found the problem here, the prop was defined as d:mltext. So it wasn't cached information, just multilanguage info. I had to extend the model and add a new prop that multilanguage, now all users have the same information.
精彩评论