• Anonymous
  • Login
  • Register
XPages Extension Library - Feature Request: userScope

Created on Dec 9, 2010
Created by Tommy Valand
Status Submitted

 

In several of the applications I make, I tend to make a caching mechanism that works on a user by user basis. The storage is a NotesDocument. The universalID is calculated by using @Password( @UserName + @DbName[1] ). The reason I use the server name when generating the universalID is to avoid replication conflicts. This is especially important when running in a clustered environment.

The use case is mostly caching of large lookups/generated content based on lookups in an environment with Readers fields. I get a great performance boost, the integrity of the Domino security model is maintained, and the IO load on the server is greatly reduced.

It would be great (!) to get something like this implemented in the extension library. 

I could write it myself in SSJS, but there's a big downside to the current SSJS API. You can't (as far as I know) bind callbacks to the XPages life cycle. For every set, you would have to save the document. If you set a lot of variables, this could potentially become a performance issue on servers that has many requests.

I have no idea on how to write a bean to do this, so I hope this might be something that fits into the XEL perspective.

I imagine the cycle something like this: beforePageLoad, load the doc. I would like "eternal" persistence, so I would think a NotesDocument is the best storage solution. Maybe there could be a background thread (to avoid blocking) that runs when the page is instantiated. Looks for userScope documents older than a week/month, and deletes them. There would have to be a check on isValid to avoid errors when trying to delete already deleted documents.

When fields are set, they're put into a viewScope map/object. When a get occurs, the field is only fetched once (if not already in the map), unless the userScope document has changed, then put into the aforementioned map.

On refresh (partial/full) the userScope document is saved. The save has to be so that it doesn't create conflicts ( NotesDocument.save( false, false ) ). This would lead to the same behavior as the current scoped variables.

I have the LotusScript to do the above, except for the purging of old/unused documents, which resides in an agent. I imagine there's a lot more to do to implement something like this in a bean, but if anyone want to try to implement this/want my LS for inspiration/ridicule, let me know :)




Taken Actions by Owners

No actions have been taken yet.


In this field you can enter the actual request.

You can use the rich text editor for rich text formating. You can also enter HTML to embed objects, e.g. to embed a YouTube video or a screenshot of the project. In this case use '[' and ']' to mark the passthrough HTML as such.

Please note that the first time you use the new UI your description is converted from rich text to MIME. You might want to copy and paste the raw plain text from the old UI in the new UI so that you don't loose information.
In this field owners can describe what they have done or want to do.

You can use the rich text editor for rich text formating. You can also enter HTML to embed objects, e.g. to embed a YouTube video or a screenshot of the project. In this case use '[' and ']' to mark the passthrough HTML as such.

Please note that the first time you use the new UI your description is converted from rich text to MIME. You might want to copy and paste the raw plain text from the old UI in the new UI so that you don't loose information.