blob: 7436054932bb82d86d1192ce829a35d57595ead6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "expcache.h"
#include "matchobject.h"
ExpansionCache::ExpansionCache(MatchObject* default_obj)
: _default(default_obj), _cache()
{}
ExpansionCache::~ExpansionCache()
{
// Delete all associated maps
_cache.delete_second();
}
MatchObject* ExpansionCache::Lookup(uint32_t langid)
{
MatchObject* m = _cache.find(langid);
if (!m)
{
m = new MatchObject(_default->Query(), _default->HasReductions(), langid);
_cache.insert(langid, m);
}
return m;
}
|