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. 09/04/2018With two big projects on hold, I suddenly find myself very available for new short and long term projects. In twenty five years, I don't think I've ever written an entry like this, but if you need the kind of work I do now would be a great time to get in touch. Both of the big projects I had lined up for late summer and early fall have been placed on hold and will be that way for a while. With the kids now all off at college and careers, I'm open to more travel than such than I have been in decades, but unless something else comes along, I'll be here working on updates to Second Signal and other things that ...... 
  2. 07/13/2018Who is HCL and why is it a good thing that they are now the ones behind Notes and Domino?We need to address some biases here. IBM has made a deal under which the Notes & Domino software and intellectual property is now being developed and maintained by HCL America. HCL America is part of the very large "HCL Technologies" company that has grown from its roots in India to become an 8 Billion Dollar company with a global presence in the IT Industry. You could be excused for initially believing, as many people do when they hear this, that "they've outsourced the code to India where they'll milk it ...... 
  3. 03/21/2018Domino Apps on IOS is a Game Changer. Quit holding back.BOOM. This will be as important for the platform as Traveler. If your company has ditched Notes and Domino, I feel sorry for you. For companies that do use Notes/Domino this is a game changer and Apple should be paying attention. Here's why: There are hundreds of little Notes client applications you'd never spend the time and money to build and deploy for your internal user base on IOS that we use Notes for all the time (those of us still using it). Now, those are suddenly ALL available on the iPad. ...... 
  4. 02/15/2018Andrew’s Proposed Gun Laws 
  5. 05/05/2016Is the growing social-sourced economy the modern back door into socialism? 
  6. 04/20/2016Want to be whitelisted? Here are some sensible rules for web site advertising 
  7. 12/30/2015Fantastic new series on Syfy called “The Expanse” – for people who love traditional science fiction 
  8. 10/20/2015My suggestion is to stay away from PayAnywhere(dot)com  
  9. 08/07/2015Here is one for you VMWARE gurus - particularly if you run ESXi without fancy drive arrays 
  10. 08/06/2015The Killer of Orphans (Orphan Documents) 
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.