mirror of
https://github.com/evopro-ag/Sharp7Reactive.git
synced 2025-12-15 11:22:52 +00:00
19 lines
576 B
C#
19 lines
576 B
C#
using System.Collections.Concurrent;
|
|
using Sharp7.Rx.Interfaces;
|
|
|
|
namespace Sharp7.Rx;
|
|
|
|
internal class CacheVariableNameParser : IVariableNameParser
|
|
{
|
|
private static readonly ConcurrentDictionary<string, VariableAddress> addressCache = new ConcurrentDictionary<string, VariableAddress>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
private readonly IVariableNameParser inner;
|
|
|
|
public CacheVariableNameParser(IVariableNameParser inner)
|
|
{
|
|
this.inner = inner;
|
|
}
|
|
|
|
public VariableAddress Parse(string input) => addressCache.GetOrAdd(input, inner.Parse);
|
|
}
|