Feature #545
persistent variables in standalone are needed
Description
We need a straightforward sollution for storing persistent information inside the server on standalone uweb instances.
This is needed for the Guard and Configserver programs in Janitor.
History
#1 Updated by Elmer de Looff almost 13 years ago
- Status changed from New to Resolved
- Assignee changed from Elmer de Looff to Jan Klopper
- % Done changed from 0 to 70
Each PageMaker instance now comes with a persistent
attribute. This links to a class constant which is accessible for each pagemaker instance for the running process.
CacheStorage
class, which supports Get
, Set
and SetDefault
methods.
- Get retrieves the value for a key, with an optional default (KeyError if none given, unlike
dict.get()
) - Set writes an entry into the cache, (key, value pair)
- SetDefault Gets the value for a key, but if the key does not exist, writes the default value in its place before returning.
The class has been made threadsafe by virtue of a Lock
around its methods.
The templateparser and various database connections have been stored in the CacheStorage
as well, in the knowledge that neither Apache or Standalone run multiple threads per process (if they would, SQLTalk.mysql would abort, this seems very much not the case). This has increased the performance measured in #526 from 2200 req/s to ~2800 req/s under similar conditions).
#2 Updated by Jan Klopper almost 13 years ago
- Status changed from Resolved to Closed
- % Done changed from 70 to 100
seems to work