[ 3 posts ]

Paul Randall

  • Username: prandall
  • Joined: Fri Jul 13, 2012 11:46 am
  • Posts: 2
  • Offline
  • Profile

Issue with maxCacheEntries

Post Posted: Fri Jul 13, 2012 12:04 pm
+0-
I am using YUI 2.9 datatable. myDataSource.maxCacheEntries = 0 however in IE 8 it still pulls from the Cache. The first time in my application it does not pull from the Cache .. any subsequent tries will not make a round trip to the DB. I want it to go to the DB every time but it is pulling from the Cache. This is only doing this in IE 8. Firefox and Chrome are working correctly.

Here is my complete code:

$.get('<%:Request.ApplicationPath.TrimEnd('/') %>/Home/getEmployeeList', function (data) {
//take the JSON string coming from /home/getEmployeeList and parse it to a javascript object which is what YUI expects
var obj = jQuery.parseJSON(data);


YAHOO.example.ClientPagination = function () {

// wanna create a custom formatter for the cell
this.CustomLinkFormatter = function (elCell, oRecord, oColumn, oData) {
var name = oRecord.getData("Name");
var UID = oRecord.getData("UID");
var hasNotes = oRecord.getData("hasNotes");

var noteString = "";
if (hasNotes == 1) {
noteString = "&nbsp;|&nbsp;<a href='<%:Request.ApplicationPath.TrimEnd('/') %>/Form/Notes/" + UID + "'>***</a>";

}
else {
noteString = "";

}


elCell.innerHTML = "<a href='<%:Request.ApplicationPath.TrimEnd('/') %>/Form/Index/" + UID + "'>View Forms</a>" + noteString + "";

// elCell.innerHTML = "<a href='<%:Request.ApplicationPath.TrimEnd('/') %>/Form/Index/" + UID + "'>View Forms</a>" +
// "&nbsp;&nbsp;&nbsp;<a href='<%:Request.ApplicationPath.TrimEnd('/') %>/Form/reAssignManager/" + UID + "'>Manager Info</a>";


};
// Add the custom formatter to the shortcuts
YAHOO.widget.DataTable.Formatter.linkFormatter = this.CustomLinkFormatter;


var myColumnDefs = [
{ key: "isAccepted", label: "Accepted?", sortable: false },
{ key: "initiated", formatter: YAHOO.widget.DataTable.formatDate, label: "Initiated", sortable: true },
{ key: "dateTime", formatter: YAHOO.widget.DataTable.formatDate, label: "Accepted", sortable: true },
{ key: "orgName", label: "Organization", sortable: true },
{ key: "lname", label: "Last Name", sortable: true },
{ key: "fname", label: "First Name" },
{ key: "Options", formatter: "linkFormatter" }



];

var myDataSource = new YAHOO.util.DataSource(obj);
myDataSource.maxCacheEntries = 0;
myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
myDataSource.responseSchema = {
fields: ["isAccepted", { key: "initiated", parser: "date" }, { key: "dateTime", parser: "date" }, "orgName", "lname", "fname", "UID", "hasNotes"]
};

var oConfigs = {
paginator: new YAHOO.widget.Paginator({
rowsPerPage: 10
})
//initialRequest: "results=3" ... not sure what this is for
};
var myDataTable = new YAHOO.widget.DataTable("employee_content", myColumnDefs,
myDataSource, oConfigs);

return {
oDS: myDataSource,
oDT: myDataTable
};
} ();

});



Any help?

Paul Randall

  • Username: prandall
  • Joined: Fri Jul 13, 2012 11:46 am
  • Posts: 2
  • Offline
  • Profile

Re: Issue with maxCacheEntries

Post Posted: Fri Jul 13, 2012 1:21 pm
+0-
Just FYI:

I don't know if this affects YUI or not but I put this in my code:

<%@ OutputCache Location="None" %>

and

<%
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = -1;
Response.Cache.SetCacheability(HttpCacheability.NoCache);
%>


in my master page.


Still doesn't work correctly. I don't want anything to cache to include the YUI component.
So far this is only an IE 8 issue. Firefox and chrome makes a DB hit everytime I load the page which is correct.

Mahesh Dyaram

  • Username: mdyaram
  • Joined: Fri Aug 03, 2012 3:29 am
  • Posts: 6
  • Offline
  • Profile

Re: Issue with maxCacheEntries

Post Posted: Mon Aug 06, 2012 11:24 pm
+0-
I am sure you would have solved the problem by now. I have joined the forum recently and have seen this post just now. But for this, simply add a bustCache=(new Date()).getTime() parameter to your URL. It will work fine in every browser. You should do it at "getEmployeeList?bustCache="+(new Date()).getTime(). The problem is not because of YUI, but because of cache of browser.
  [ 3 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum