substrhash.html

来自「perl教程」· HTML 代码 · 共 77 行

HTML
77
字号
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>Tie::SubstrHash - Fixed-table-size, fixed-key-length hashing</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>

<body>

<script>writelinks('__top__',2);</script>
<h1><a>Tie::SubstrHash - Fixed-table-size, fixed-key-length hashing</a></h1>
<p><a name="__index__"></a></p>

<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#caveats">CAVEATS</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Tie::SubstrHash - Fixed-table-size, fixed-key-length hashing</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    <span class="keyword">require</span> <span class="variable">Tie::SubstrHash</span><span class="operator">;</span>
</pre>
<pre>
    <span class="keyword">tie</span> <span class="variable">%myhash</span><span class="operator">,</span> <span class="string">'Tie::SubstrHash'</span><span class="operator">,</span> <span class="variable">$key_len</span><span class="operator">,</span> <span class="variable">$value_len</span><span class="operator">,</span> <span class="variable">$table_size</span><span class="operator">;</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <strong>Tie::SubstrHash</strong> package provides a hash-table-like interface to
an array of determinate size, with constant key size and record size.</p>
<p>Upon tying a new hash to this package, the developer must specify the
size of the keys that will be used, the size of the value fields that the
keys will index, and the size of the overall table (in terms of key-value
pairs, not size in hard memory). <em>These values will not change for the
duration of the tied hash</em>. The newly-allocated hash table may now have
data stored and retrieved. Efforts to store more than <code>$table_size</code>
elements will result in a fatal error, as will efforts to store a value
not exactly <code>$value_len</code> characters in length, or reference through a
key not exactly <code>$key_len</code> characters in length. While these constraints
may seem excessive, the result is a hash table using much less internal
memory than an equivalent freely-allocated hash table.</p>
<p>
</p>
<hr />
<h1><a name="caveats">CAVEATS</a></h1>
<p>Because the current implementation uses the table and key sizes for the
hashing algorithm, there is no means by which to dynamically change the
value of any of the initialization parameters.</p>
<p>The hash does not support exists().</p>

</body>

</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?