mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-07-31 01:40:42 +00:00
Rate Policy
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using Esiur.Resource;
|
||||
using System.Threading;
|
||||
|
||||
namespace Esiur.Tests.Unit.Integration;
|
||||
|
||||
[Resource]
|
||||
public partial class RateLimitedResource
|
||||
{
|
||||
int _callCount;
|
||||
int _value;
|
||||
|
||||
[Export]
|
||||
[RateControl("standard-call")]
|
||||
public int Call() => Interlocked.Increment(ref _callCount);
|
||||
|
||||
[Export]
|
||||
[RateControl("standard-set")]
|
||||
public int Value
|
||||
{
|
||||
get => _value;
|
||||
set => _value = value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user