[#CuckooCache-cache-insert]
= xref:CuckooCache.adoc[CuckooCache]::xref:CuckooCache/cache.adoc[cache]::insert
:relfileprefix: ../../
:mrdocs:

insert loops at most depth&lowbar;limit times trying to insert a hash at various locations in the table via a variant of the Cuckoo Algorithm with eight hash locations&period;

== Synopsis

Declared in `&lt;cuckoocache&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
insert(Element e);
----

== Description

It drops the last tried element if it runs out of depth before encountering an open slot&period;

Thus&colon;

&grave; insert(x)&semi; return contains(x, false)&semi; &grave;

is not guaranteed to return true&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *e*
| the element to insert
|===

== Postconditions

* one of the following&colon; All previously inserted elements and e are now in the table, one previously inserted element is evicted from the table, the entry attempted to be inserted is evicted&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
