pageCache: simple LRU cache of visited URLs

pageCache 1.1

What is it?
A drop-in replacement for visit_url that implements a simple LRU cache.

Script developers can use visit_cached_url(string) instead of visit_url(string).

Note: Depends on zarqon's excellent zlib.ash and my log_lib.ash make sure you install them first.

For Users

Should be transparent to end users, but see Issues

For Script Authors

Currently caches four pages, and invalidates pages not from the current day and turn. All of these are tunable via variables in the start of the script.

Methods

string visit_cached_url(string url)

Issues

Does not invalidate cache if you change users (but is only an issue if you have two users on the same turncount)

Does not invalidate quest pages if you visit the guild to complete or start a quest (because that doesn't use a turn.)


Change Log
1.0 2009/11/18 Initial release
1.1 2009/11/20 Check "lastCouncilVisit" to invalidate cache if you visit the council
 

Attachments

  • pageCache.ash
    3.6 KB · Views: 133
Last edited:

Catch-22

Active member
This is nice. It would be neat if you could specify the expiration of pages individually, but that would kinda defeat the whole LRU idea...
 
I'm also considering expanding the default cache size but I wanted to make sure it played nice first. I've tested it and the page cache is pretty small, so I think it might be ok.
 
Top