"Tony Proctor" <tony_proctor@aimtechnology_NoMoreSPAM_.comschri eb im
Newsbeitrag news:OM**************@TK2MSFTNGP04.phx.gbl...
I did see your example Olaf but it wasn't really applicable
for what I need.
I'd say, that you could adapt the approach very easy
to your problem.
I actually have a VB class that stores multiple Dictionary
objects in an array - one per "resource" being cached.
Each Dictionary could have 20k-30k items in it.
That's also no problem, since you could hold separate
Arrays (as much as you want) for each resource.
I assume, your current Dictionaries store simple
StringKey<->SingleValue-Pairs for each resource
(accessing each Value over the hashed StringKey).
You can do exactly the same with my approach, and
you could even store StringKey<->MutipleRecordValues
without any problems as long as the RecordValues
only contain simple Types (Strings, Longs, Doubles, etc.).
Hence, the problem with memory usage, and why I need
a hashed lookup rather than a binary chop.
The binary chop was meant to work on the (sorted)
StringKeys of each "Record-Entry" and if implemented
right, retrieving Values by Key or a check for KeyExists
is processed at the same speedlevel as the hashed lookup
of the MS-ScriptingDictionary or the VB-Collection.
In fact the keyed-access would be *much* faster in your
special case, than working against a *marshaled* singleton-
object, because of the non-existent OLE-Call-overhead.
If you work readonly against your Resource-Caches,
you wouldn't even need to implement CriticalSection-
based locking with this approach.
In the current example there is also an defined entry-
point for the STA, wich is the first user of the shared
cache - at this point you could fill all your data into
each of the Resource-Caches.
But I understand, that you want to avoid coding-effort
and that reusing your already existing Resource-Cache-
Class as a singleton would be the easiest way (if you
manage, to get proper singleton-instancing in global.asa).
Just let me know, when the marshaled singleton-approach
doesn't work as you imagine - would enhance the example
then with "multiple Resource-Caching-capabilities" + some
appropriate KeyExists and GetRecordByKey-Methods
for the multiple Resource-Caches.
Olaf