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