Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
671e159
Skeleton
mikechu-optimizely Aug 5, 2022
3d1ae15
LruCache initial implementation
mikechu-optimizely Aug 5, 2022
b987d9d
Add helper extensions
mikechu-optimizely Aug 5, 2022
295fdd2
WIP Fill unit tests
mikechu-optimizely Aug 5, 2022
50fd4e1
WIP corrections based on tests 2 more failing
mikechu-optimizely Aug 5, 2022
22acf8e
Remove SetTimeout, fix for non-passing test
mikechu-optimizely Aug 8, 2022
d2e3373
Add copyright notices
mikechu-optimizely Aug 8, 2022
d758efb
Remove InternalsVisibleTo for testing
mikechu-optimizely Aug 8, 2022
da33c99
Add new line at end of files via .editorconfig
mikechu-optimizely Aug 8, 2022
9fe246e
Readonly and remove excess methods/constructor
mikechu-optimizely Aug 8, 2022
33dc181
Code review corrections
mikechu-optimizely Aug 10, 2022
2f35de3
WIP code review changes
mikechu-optimizely Aug 10, 2022
24737fe
Possibly better solution to cast
mikechu-optimizely Aug 10, 2022
e042d99
Move readonlys into constructor
mikechu-optimizely Aug 10, 2022
6749182
Switch to using TimeSpan + refactors
mikechu-optimizely Aug 11, 2022
2bac003
A few more refactors
mikechu-optimizely Aug 11, 2022
03c9abf
Change underlying implementation of LRU
mikechu-optimizely Aug 12, 2022
209c3bd
Attempt to fulfill a default Timespan
mikechu-optimizely Aug 16, 2022
42a735d
Add logging; use 0s instead of descriptive consts
mikechu-optimizely Aug 16, 2022
722780c
Remove Tuple from LRU Cache
mikechu-optimizely Aug 16, 2022
ea2f32a
Remove System.ValueTuple NuGet package
mikechu-optimizely Aug 16, 2022
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Code review corrections
  • Loading branch information
mikechu-optimizely committed Aug 10, 2022
commit 33dc181e3d16b64c17de340385eb7fd2ec639f7b
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace OptimizelySDK.Odp
{
public interface ILruCache<T>
public interface ICache<T>
{
void Save(string key, T value);
T Lookup(string key);
Expand Down
6 changes: 3 additions & 3 deletions OptimizelySDK/Odp/LruCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

namespace OptimizelySDK.Odp
{
public class LruCache<T> : ILruCache<T>
public class LruCache<T> : ICache<T>
{
public const int DEFAULT_MAX_SIZE = 10000;
public const int DEFAULT_TIMEOUT_SECONDS = 600;
Expand All @@ -35,8 +35,8 @@ public LruCache() : this(DEFAULT_MAX_SIZE, DEFAULT_TIMEOUT_SECONDS, null) { }

public LruCache(int maxSize, int timeoutSeconds, ILogger logger = null)
{
_maxSize = maxSize < 0 ? default : maxSize;
_timeoutMilliseconds = (timeoutSeconds < 0) ? 0 : (timeoutSeconds * 1000L);
_maxSize = maxSize < 0 ? 0 : maxSize;
_timeoutMilliseconds = timeoutSeconds < 0 ? 0 : timeoutSeconds * 1000L;
_logger = logger ?? new DefaultLogger();
}

Expand Down
2 changes: 1 addition & 1 deletion OptimizelySDK/OptimizelySDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<Compile Include="Entity\Integration.cs" />
<Compile Include="Event\Entity\DecisionMetadata.cs" />
<Compile Include="Odp\DateTimeExtension.cs" />
<Compile Include="Odp\ILruCache.cs" />
<Compile Include="Odp\ICache.cs" />
<Compile Include="Odp\LruCache.cs" />
<Compile Include="OptimizelyDecisions\DecisionMessage.cs" />
<Compile Include="OptimizelyDecisions\DecisionReasons.cs" />
Expand Down