Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

caching database info??

Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
05-30-2009 12:06
I have an object that gets data from an external PHP file when touched.
When I change the content of the PHP file I notice that I need to touch the object several times before it shows the new content. It shows the old content first and then finally gets the new stuff.

Any clue?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-30-2009 15:47
does it exhibit the same behavior if addressed from a browser with the cache cleared?

there's too much we don't know about either end point implementation here, but to my knowledge SL http requests are NOT cached.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
05-30-2009 16:26
Probably it takes your web server a bit of time to check whether the PHP file has changed and reload it if it has. If you really wanted to test that and you have sufficient administrative control over your server, you could restart your web server just after changing the file and see if you get the same results.
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
05-31-2009 09:52
Thanks for the input.

The issue has to be within second life. I can rezz a copy of the object and touch it and it STILL displays old data. Very strange because its simply going to a PHP file on my server and getting text. Yet the text is from months ago. I only use 1 php file and change the text in that file so it cant be getting the old data from my server. It has to be within second life.

I find that if I touch it 3 or 4 times it finally gets displays the current PHP info.
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
05-31-2009 10:30
Below is the code in my object. It calls data.php which simple returns some text.
I created the object many months ago and it appear that when I rezz and touch it displays the text that was in the first data.php ! even though data.php has changed about 10 times now. If I keep touching then it finally gets to the new data.

Is there FLUSH or something I can do on state_entry to clear this issue up?


default
{

state_entry()
{



}



touch_start(integer total_number)
{

//llSay(0, "Touched.";);
key tbownerKey = llGetOwner();
string tbowner = llKey2Name(tbownerKey);
string tbname = llKey2Name(tbownerKey);
string tbregion = llGetRegionName();
vector tblocation = llGetPos(); // and this.
vector tbglobalcoord = llGetRegionCorner() + llGetPos(); // and this.
integer tbtimestamp = llGetUnixTime();
string tbcoordx = (string)tblocation.x;
string tbcoordy = (string)tblocation.y;
string tbcoordz = (string)tblocation.z;
string tbtoucherget = (string)llDetectedKey(0);
string tbtoucher = llKey2Name(tbtoucherget);
gToucher = (string)llDetectedKey(0);



gMyTRequest = llHTTPRequest("http://www.mywebsite.com/data.php", [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"], "tbowner="+(string)tbowner+"&tbname="+(string)tbname + "&tbregion="+(string)tbregion + "&tblocation=" + (string)tblocation + "&tbownerKey=" + (string)tbownerKey+
"&tbcoordx= "+(string)tbcoordx + "&tbcoordy=" + (string)tbcoordy + "&tbcoordz=" + (string)tbcoordz + "&tbtoucher=" + (string)tbtoucher) ;
[HTTP_METHOD,"POST"] ,"";);

}
http_response(key id,integer status, list meta, string body)
{

if(gMyTRequest==id)
{
integer i;
list lbody=llParseString2List(body,["\n"],[]);
integer count=llGetListLength(lbody);
//This turns newline characters char(10) into new lines in chat
//These are Unix/LSL style end of lines, use \r\n in place of \n for
// Windows style end of line from web server.
for(i=0;i<count;i++)
{
// llOwnerSay(llList2String(lbody,i));
llInstantMessage(gToucher,llList2String(lbody,i));
llInstantMessage(llGetOwner(),llList2String(lbody,i));
//llShout(0,llList2String(lbody,i));
// llSay(0,llList2String(lbody,i));
}
}

}

}
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
05-31-2009 11:07
I am going to try and add this

on_rez( integer param )
{
llResetScript();
}

maybe that will help
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
05-31-2009 11:26
you server doesn't have to cache the file for it to be an outside caching issue... if anything up stream of it caches the response, then you'll see that... if that's the case and you are running your own server, you can configure it to set no-cache meta data on php files for the intervening host (though there is no guarantee they'll be obeyed).
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -