Re: How to persist and query a hash lookup in memory with Perl ?



Jack wrote:
[...]
So, not using another DB

If you're already using a Database then just store the data there, why
would you use another Database to store it?

>how does one pin and persist and then query a hash in memory using
perl or a perl module.

Whatever 'pin' a hash means.

Why do you want to do this? Maybe that's the real problem. You
think that's what you want to do, but it's really not needed.

You could have a daemon running, that reads/creates the hash and
then it would have the data in memory. You could then then connect
to it via a socket, but why the heck do you want to do all of
that? That's really not Perl 101 and I'm pretty sure you'd
end up spending a lot of time understanding it and trying to get it
working, however it'll take 20-seconds to write and will be very
fast, using a tied hash.

There are a lot of examples online and you can read the documentation
that comes with perl.

perldoc DB_File

If you want to go the whole daemon and IPC/socket route:

perldoc perlipc
.



Relevant Pages

  • Re: hash table size
    ... talking about chess programming ideas and what they do rather than actually ... you can clear out the memory. ... Just a couple cycles per hash check. ... The amount of physical memory each user gets is likely to be somewhat ...
    (rec.games.chess.computer)
  • Re: hash table size
    ... Change all the hash keys so you get a new random value. ... This way old entries from the previous search (or uninitialized hash memory) ... It is true that doing an AND is faster than a modulo. ... If you are runing a chess program for a reason, ...
    (rec.games.chess.computer)
  • Re: Firewall vs. IPS - Differences now (ISS, Intrushield 2.1?)
    ... > You risk running out of memory. ... That's like saying "it's trivial to DoS Aho-Corasic if you know the ... DoS's and improvements via use of the Jenkins hash are most illuminating. ... > replacement policy gives the worst behavior since an attacker can flood ...
    (Focus-IDS)
  • Re: [PATCH] tracing/kmemtrace: normalize the raw tracer event to the unified tracing API
    ... branch tracer needs that too for example. ... SLUB statistics and is only good for detecting allocation hotspots, ... to track would be the memory object itself. ... would be to do a static, limited size hash that could track up to N memory ...
    (Linux-Kernel)
  • Re: Ruby, memory and speed
    ... and then emit a summary on standard input. ... The hash will grow to about 500 000 keys. ... Is there any tuning of GCC so it kicks in less frequently when the memory consumption is large? ... Or could it be that the Hash algorithm chokes when the number of keys gets large? ...
    (comp.lang.ruby)