1\name{hashcache}
2\alias{hashcache}
3\alias{sortcache}
4\alias{sortordercache}
5\alias{ordercache}
6\title{
7		Big caching of hashing, sorting, ordering
8}
9\description{
10	Functions to create cache that accelerates many operations
11}
12\usage{
13hashcache(x, nunique=NULL, \dots)
14sortcache(x, has.na = NULL)
15sortordercache(x, has.na = NULL, stable = NULL)
16ordercache(x, has.na = NULL, stable = NULL, optimize = "time")
17}
18\arguments{
19  \item{x}{
20		an atomic vector (note that currently only integer64 is supported)
21}
22  \item{nunique}{ giving \emph{correct} number of unique elements can help reducing the size of the hashmap }
23  \item{has.na}{
24boolean scalar defining whether the input vector might contain \code{NA}s. If we know we don't have NAs, this may speed-up.
25\emph{Note} that you risk a crash if there are unexpected \code{NA}s with \code{has.na=FALSE}
26}
27  \item{stable}{
28boolean scalar defining whether stable sorting is needed. Allowing non-stable may speed-up.
29}
30  \item{optimize}{
31by default ramsort optimizes for 'time' which requires more RAM,
32set to 'memory' to minimize RAM requirements and sacrifice speed
33}
34  \item{\dots}{
35		passed to \code{\link{hashmap}}
36}
37}
38\details{
39	The result of relative expensive operations \code{\link{hashmap}}, \code{\link{ramsort}}, \code{\link{ramsortorder}} and \code{\link{ramorder}} can be stored in a cache in order to avoid multiple excutions. Unless in very specific situations, the recommended method is \code{hashsortorder} only.
40}
41\note{
42  Note that we consider storing the big results from sorting and/or ordering as a relevant side-effect,
43and therefore storing them in the cache should require a conscious decision of the user.
44}
45\value{
46	\code{x} with a \code{\link{cache}} that contains the result of the expensive operations, possible together with small derived information (such as \code{\link{nunique.integer64}}) and previously cached results.
47}
48\author{
49Jens Oehlschlägel <Jens.Oehlschlaegel@truecluster.com>
50}
51\seealso{
52	\code{\link{cache}} for caching functions and \code{\link{nunique}} for methods bennefitting from small caches
53}
54\examples{
55	x <- as.integer64(sample(c(rep(NA, 9), 1:9), 32, TRUE))
56 sortordercache(x)
57}
58\keyword{ environment }
59