caching - hash tables' application in cache -
I have read the wiki page about the hash table. So I saw something like this:
The hash table can be used to implement the cache, the assistive data tables that primarily to accelerate access to the data stored in the slow media Is used.
I wonder how does the hash speed up the cache? Can anyone tell me about it?
Each access in the cache will need the hash code of the lookup key, and in the cache Each extra will also need to know the hash code. A smart cache that combines two functions ("Find by the key if it does not exist, get the right value and cache it") Potentially can not compute the hash twice
Usually the hashs are relatively cheap to calculate - and accessing the underlying resources is cheaper too is cached ... and it all is not like
In some cases it can be cached for itself - in Java, for example, the
string class cache hashodes when it first counts Whether it is really beneficial or not depends on your situation.
Comments
Post a Comment