Andrew Pollack's Blog

Technology, Family, Entertainment, Politics, and Random Noise

A very strange cache difference between LotusScript running in a WQO and Formula Language on a form.

By Andrew Pollack on 05/03/2007 at 03:46 PM EDT

I have this form, and on the form is a field. The field is populated by doing an @DbColumn() call to a view in another database. The documents in that view are protected with reader-names fields, which are themselves group names. By adding a user to one of the groups, they see more documents. Makes sense, yes?

Now, suppose a user is on page with this kind of field on it, and does a submit or something which cases his name to be added to a group that should let him see more documents from that view. How long do you suppose it should take for him to see additional documents?

Wrong.

If I just continue to do it the way I have been, with a dbColumn() call in the field on the form -- it can be a really long time. In fact, it can be measured in minutes from the last refresh. That seems to mean if you keep looking for the change you keep delaying it.

In debugging this, I tried everything -- including "noCache" on the lookup and even named caches (which I don't even know are still valid) and server side settings for user cache duration and such. Nothing.

Finally, I created a WQO (Web Query Open) agent and had it set to run as the web user (his credentials), open the same view, and just output to the Domino console which documents it could see. Guess what...In the LotusScript WQO the update was nearly instant. Nonetheless, even then the lookup only returned the original documents.

I had the WQO write the values to the field instead -- and that worked a little. Of course, due to the nature of a WQO agent, no other fields on the form could use the value for calculation. In the end, what I did was create a text field set to computed for display called "[dscript]". I set the formula to simply the field name, so it always set itself to its own value. I also put the field in a text area that was set as style "HTML Passthrough". Finally, I had the WQO agent write javascript as text to the field like so: "<script> var lookupArray = new Array('val1', 'val2', 'val3', 'val4' .....); </script>"

Now, the rest of the javascript on the form has access to that array of values I wanted -- updated almost as soon as you add the person's name to the group. Oh, and STILL the @DbLookup does not update.


There are  - loading -  comments....

re: A very strange cache difference between LotusScript running in a WQO and Formula Language on a form.By Thomas Bahn on 05/04/2007 at 04:16 AM EDT
Its obvious that not the "normal" cache is "guilty", but the name lookup cache.
The HTTP task looks up the users credentials like the groups he belongs to. For
the next request, it uses the cached value. Every request seems to restart a
kind of timer. Thus if you do not do requests, the timer will timeout after x
minutes, if you do request in the meantime, the timer is restarted.

The WQS agent on the other side seems not to use the same name lookup context
and gets the credentials directly from the server.

Just my 2 cents
Thomas
http://www.asssono.de/blog.nsf/
I doubt it's the global name lookup cache.By Andrew Pollack on 05/04/2007 at 07:58 PM EDT
Consider it this simplified way:

1. Open a web page.
WQO agent outputs to the console the list of docs it can see, contains 5
documents. @DB formula shows on the page the same 5 documents.

2. Add the username to a group in the nab, giving access to more documents.

3. Refresh the page. WQO agent now sees additional documents, but @dbformula
does not -- and will not for a very long time. (unknown how long).

So you see in #3 that there are two different cache issues. I don't believe it
is the name lookup cache. I believe that it is the dblookup cache, which is
supposed to be disabled with the "nocache" parameter in the dblookup call.
IMHO, that isn't happening. Most of the time, who would really notice?
re: I doubt it's the global name lookup cache.By Thomas Bahn on 05/05/2007 at 06:35 PM EDT
I really believe, there is a kind of "name lookup cache", where the groups, a
user belongs to, is cached in the client (like Graham). In this case, the
client is the HTTP task. I do not mean the name lookup cache of the server
itself (show nlcache in server console).

I think, that any formula is executed in the context of the HTTP task and uses
its "name lookup cache". LotusScript agents seem to run outside of this
context. This makes sense in that they could run with different credentials
depending on their settings (signer, on behalf of, web user).

I don't think, it is a @DbLookup cache. In the situation you described, what if
a document is added, which is visible for the users without group changes? It
will get on the view immediately for @DbLookup, I presume.

The only thing, I can think of, why it could be a @DbLookup issue is: The view
itself isn't changed. If there are no new documents, the timestamp, when the
view has been changed most recently, keeps the same. So does any index built on
this view. IF @DbLookup relied on this timestamp, it would think, that the view
hasn't been changed and therefore it could display the same as last time.

Thomas
http://www.assono.de/blog.nsf/
re: A very strange cache difference between LotusScript running in a WQO and Formula Language on a form.By Graham Richards on 05/04/2007 at 02:31 PM EDT
Two ideas (guesses) here ...

First : When you first access the view, the server may create a list of records
you can see, and associates that with your session, so it does not have to keep
doing look-ups as you continue to access the view. Thus, group updates would
not be effective while you have that view "open"

Second : When you initially log-on to your Notes ID, a lookup is done on your
home server to see which groups you are in. (This list can be seen in the
Groups and Roles window when you check your database access with the icon on
the lower-right of the client's screen.)

This list is not refreshed very often - indeed, I recommend that a user logoff
(F5) and back on to refresh the list if they have been added to groups, but
it's not effective.

I'm guessing that when your client is asking the server for the view, it's
passing that Groups-I-am-in list to the server, possibly signed by the
organization ID so it can be trusted. In this way, the server does not have to
lookup group membership every-time someone hits the view.

In either case, what happens if you log off the idea and log on again ? Does
that give you an updated list of records ?
Possible, it it should not happen.By Andrew Pollack on 05/04/2007 at 07:59 PM EDT
remember, after a group name add to the nab WQO agent now sees additional
documents, but @dbformula does not -- and will not for a very long time.
(unknown how long).

The authentication data in both cases is the same -- the wqo is running as web
user.


I don't believe it is the name lookup cache. I believe that it is the dblookup
cache, which is supposed to be disabled with the "nocache" parameter in the
dblookup call. IMHO, that isn't happening. Most of the time, who would really
notice?


Other Recent Stories...

  1. 05/05/2016Is the growing social-sourced economy the modern back door into socialism?Is the growing social-sourced economy the modern back door into socialism? I read a really insightful post a couple of days ago that suggested the use of social network funding sites like “Go Fund Me” and “Kickstarter” have come about and gained popularity in part because the existing economy in no longer serving its purpose for anyone who isn’t already wealthy. Have the traditional ways to get new ventures funded become closed to all but a few who aren’t already connected to them and so onerous as to make ...... 
  2. 04/20/2016Want to be whitelisted? Here are some sensible rules for web site advertisingAn increasing number of websites are now detecting when users have ad-blocking enabled, and refuse to show content unless you "whitelist" their site (disable your ad-blocking for them). I think that is a fair decision on their part, it's how they pay for the site. However, if you want me (and many others) to white list your site, there are some rules you should follow. If you violate these rules, I won't whitelist your site, I'll just find content elsewhere. 1. The total space taken up by advertisements ...... 
  3. 12/30/2015Fantastic new series on Syfy called “The Expanse” – for people who love traditional science fiction[] “The Expanse” is a new science fiction series being broadcast onthe Syfy channelthis winter. It’s closely based on a series of books by author James S. A. Corey beginning with “Leviathan Wakes”. There are 5 books in the “Expanse” series so far. If you’re a fan of the novels you’ll appreciate how closely the books are followed.TIP: The first five episodes are already available on Syfy.com. If you’re having trouble getting into the characters and plot, use those to get up to speed.The worlds created for ...... 
  4. 10/20/2015My suggestion is to stay away from PayAnywhere(dot)com  
  5. 08/07/2015Here is one for you VMWARE gurus - particularly if you run ESXi without fancy drive arrays 
  6. 08/06/2015The Killer of Orphans (Orphan Documents) 
  7. 06/02/2015Homeopathic Marketing: Traveler on my Android is now calling itself VERSE. Allow me to translate that for the IBM Notes community... 
  8. 03/17/2015A review of British Airways Premium Economy Service – How to destroy customer goodwill all at once 
  9. 02/26/2015There's a bug in how @TextToTime() and @ToTime() process date strings related to international standards and browser settings. 
  10. 01/21/2015Delivering two new presentations at Developer Camp (EntwicklerCamp) 2015 in Germany 
Click here for more articles.....


pen icon Comment Entry
Subject
Your Name
Homepage
*Your Email
* Your email address is required, but not displayed.
 
Your thoughts....
 
Remember Me  

Please wait while your document is saved.