Skip to content

Commit

Permalink
Merge branch 'main' into release/v2_0_0
Browse files Browse the repository at this point in the history
  • Loading branch information
jodydonetti authored Jan 19, 2025
2 parents 114ee96 + 3f8e442 commit b82e92d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### MIT License

Copyright (c) 2020-2024 Jody Donetti
Copyright (c) 2020-2025 Jody Donetti

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 deletions docs/AutoClone.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,28 @@ cache.SetupSerializer(new FusionCacheSystemTextJsonSerializer());
cache.Set("foo", new Person { Name = "John" });

// THIS WILL GET A CLONE
// RETURNS A CLONE OF THE CACHED INSTANCE
var person1 = cache.GetOrDefault<Person>("foo", options => options.SetAutoClone(true));
Console.WriteLine($"person1: {person1.Name}");
Console.WriteLine();

// THIS WILL GET A CLONE, AND CHANGE (ONLY) IT
// RETURNS A CLONE OF THE CACHED INSTANCE: CHANGES APPLIED ONLY THE CLONE, CACHED INSTANCE REMAINS UNCHANGED
var person2 = cache.GetOrDefault<Person>("foo", options => options.SetAutoClone(true));
person2.Name = "Jane";
Console.WriteLine($"person1: {person1.Name}");
Console.WriteLine($"person2: {person2.Name}");
Console.WriteLine();

// THIS WILL GET THE INSTANCE IN THE CACHE, AND CHANGE IT
// RETURNS DIRECT REFERENCE TO THE CACHED INSTANCE: CHANGES APPLIED TO THE CACHED INSTANCE ITSELF
var person3 = cache.GetOrDefault<Person>("foo");
person3.Name = "Jim";
Console.WriteLine($"person1: {person1.Name}");
Console.WriteLine($"person2: {person2.Name}");
Console.WriteLine($"person3: {person3.Name}");
Console.WriteLine();

// THIS WILL GET THE INSTANCE IN THE CACHE AGAIN, AND CHANGE IT
// SO, BOTH person3 AND person4 WILL HAVE THE SAME REFERENCE
// RETURNS DIRECT REFERENCE TO THE CACHED INSTANCE: THE INSTANCE IS THE SAME AS BEFORE
// CHANGES APPLIED TO BOTH person3 AND person4 AS THEY POINT TO THE SAME CACHED INSTANCE
var person4 = cache.GetOrDefault<Person>("foo");
person4.Name = "Joe";

Expand Down
2 changes: 1 addition & 1 deletion docs/AutoRecovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Both the [distributed cache](CacheLevels.md) and the [backplane](Backplane.md) a

This means that, as we know from the [Fallacies Of Distributed Computing](https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing), something may go wrong while we are using them, even if only in a transient way.

For example the backplane can loose the connection for some time and each (or some) of the nodes' local memory caches will become out of sync because of some missed backplane notifications. Another example is that the distributed cache can become unavailable for a while because it is restarting or because an unhandled network topology change has disrupted the connectivity for a brief moment, and a value which has been already saved in the local memory cache may not have been saved to the distributed cache.
For example the backplane can lose the connection for some time and each (or some) of the nodes' local memory caches will become out of sync because of some missed backplane notifications. Another example is that the distributed cache can become unavailable for a while because it is restarting or because an unhandled network topology change has disrupted the connectivity for a brief moment, and a value which has been already saved in the local memory cache may not have been saved to the distributed cache.

Looking at the available methods (like `Set`, `Remove`, `GetOrSet`, etc) we can say that the *intent* of our actions is clear, like *"I want to set the cache entry for this cache key to this value"*: wouldn't it be nice if FusionCache would help us is some way when transient error happens?

Expand Down
2 changes: 1 addition & 1 deletion docs/DiskCache.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

| ⚡ TL;DR (quick version) |
| -------- |
| When we want to ease cold starts but don't want need multi-nodes support, we can use an implementation of `IDistributedCache` based on SQLite to achieve that. |
| When we want to ease cold starts but don't want or need multi-nodes support, we can use an implementation of `IDistributedCache` based on SQLite to achieve that. |

In certain situations we may like to have some of the benefits of a 2nd level like better cold starts (when the memory cache is initially empty) but at the same time we don't want to have a separate **actual** distributed cache to handle, or we simply cannot have it. A good example of that may be a mobile app, where everything should be self contained.

Expand Down

0 comments on commit b82e92d

Please sign in to comment.