mirror of
https://github.com/esiur/esiur-dotnet.git
synced 2026-10-24 03:50:57 +00:00
Rate Policy
This commit is contained in:
1 parent
31bda58460
commit
4f6d2d0801
46 files changed
+3142
-468
No files matched your search
@@ -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