Пример #1
0
        private static CompiledExpression getCompiledExpression(string expression)
        {
            lock (_cacheLock)
            {
                bool success = _cache.TryGetValue(expression, out CompiledExpression ce);

                if (!success)
                {
                    var compiler = new FhirPathCompiler();
                    ce = compiler.Compile(expression);

                    if (_cache.Count >= MAX_FP_EXPRESSION_CACHE_SIZE)
                    {
                        var lruExpression = _mruList.First();
                        _cache.Remove(lruExpression);
                        _mruList.Remove(lruExpression);
                    }

                    _cache.Add(expression, ce);
                }

                _mruList.Remove(expression);
                _mruList.Add(expression);

                return(ce);
            }
        }
Пример #2
0
        private static CompiledExpression Compile(string expression)
        {
            var compiler = new FhirPathCompiler();

            return(compiler.Compile(expression));
        }