Forum Discussion
EnTerr
11 years agoRoku Guru
Just think of teh registry as a dictionary of dictionaries (i.e. `registry.section.key = strValue`) with different API. Only when reading it from disk (on obj creation) or writing to disk (on flush) there is a (minimal) performance hit. It does not matter if you work with a roRegistrySection or roRegistry, to/from disk takes the same time per current implementation. Just think of it as a single INI file, that should help.
Doing a MRU (most-recently used) list is as simple as storing array of content IDs under some registry key. Where the natural order of the array determines what's the newest. And the only maintenance step is to enforce array size below certain maximum. In code-ese:
Doing a MRU (most-recently used) list is as simple as storing array of content IDs under some registry key. Where the natural order of the array determines what's the newest. And the only maintenance step is to enforce array size below certain maximum. In code-ese:
reg = createObject("roRegistrySection", "sect")
'read MRU from disk
MRU = reg.read("MRU").tokenize(",")
'store MRU to disk
val = ""
first = MRU.count() - 10: if first < 0 then first = 0
for i = first to MRU.count() - 1:
val = val + MRU[i] + ","
end for
reg.write("MRU", val)
reg.flush()