Skip to content

Commit

Permalink
chore(deps): update dependency ziggycreatures.fusioncache to v1.3.0 (#…
Browse files Browse the repository at this point in the history
…1005)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[ZiggyCreatures.FusionCache](https://github.com/ZiggyCreatures/FusionCache)
| `1.2.0` -> `1.3.0` |
[![age](https://developer.mend.io/api/mc/badges/age/nuget/ZiggyCreatures.FusionCache/1.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/nuget/ZiggyCreatures.FusionCache/1.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/nuget/ZiggyCreatures.FusionCache/1.2.0/1.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/nuget/ZiggyCreatures.FusionCache/1.2.0/1.3.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>ZiggyCreatures/FusionCache
(ZiggyCreatures.FusionCache)</summary>

###
[`v1.3.0`](https://github.com/ZiggyCreatures/FusionCache/releases/tag/v1.3.0)

#### ♊ Auto-Clone
([docs](https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/AutoClone.md))

In general is never a good idea to mutate data retrieved from the cache:
it should always be considered immutable/readonly.
To see why, read more in the
[docs](https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/AutoClone.md).

Not all the scenarios where mutating a piece of data we got from the
cache are necessarily wrong though, as users may have a particular use
case where that may be needed, and ideally they should be abe to do that
in an easy (and optimized!) way, by following the tried and true *"it
just works"* mindset.

With Auto-Clone this is now possible.

A couple of details:

-   it just works, out of the box
-   is easy to use
- doesn't require extra coding/setup (it's just a new `EnableAutoClone`
option)
-   uses existing code infrastructure (eg: IFusionCacheSerializer)
-   has granular control on a per-entry basis
-   is performant (as much as possible)

Thanks to community users
[@&#8203;JarrodOsborne](https://github.com/JarrodOsborne) and
[@&#8203;kzkzg](https://github.com/kzkzg) !

See [here](https://github.com/ZiggyCreatures/FusionCache/issues/279)
for the original issue.

#### 💣 Fail-Safe Without Exceptions
([docs](https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/FailSafe.md))

Currently the way to activate
[fail-safe](https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/FailSafe.md)
is for a factory to throw an exception.

This makes sense, since the whole point of fail-safe is to protect us
when an error occurs while executing a factory.

But there may be other ways to do it, for example by using a variation
of the Result Pattern or similar approaches, in which throwing an
exception is not necessary.

This is now possible thanks to the new `Fail(...)` method on the
`FusionCacheFactoryExecutionContext<TValue>` type, which we can access
when executing a factory.

A quick example:

```csharp
var productResult = await cache.GetOrSetAsync<Result<Product>>(
	$"product:{id}",
	async (ctx, ct) =>
	{
		var productResult = GetProductFromDb(id);

		if (productResult.IsSuccess == false)
		{
			return ctx.Fail(productResult.Error);
		}

		return productResult;
	},
	opt => opt.SetDuration(duration).SetFailSafe(true)
);
```

Thanks to community user
[@&#8203;chrisbbe](https://github.com/chrisbbe) that noticed it!

See [here](https://github.com/ZiggyCreatures/FusionCache/issues/280)
for the original issue.

#### 🧙‍♂️ Adaptive Caching on errors
([docs](https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/AdaptiveCaching.md))

Previously it was not possible to use adaptive caching when an error
occurred during a factory execution.
This was usually not a big issue, but it left a particular edge case not
fully uported: selectively enabling/disabling fail-safe on errors.
Now this is possible, in the usual unified way.

Thanks to community user
[@&#8203;cmeyertons](https://github.com/cmeyertons) for spotting it,
and for creating the PR that solved it.

See [here](https://github.com/ZiggyCreatures/FusionCache/issues/275)
for the original issue.

#### 📦 More granular (and less) dependencies with multi-targeting

Thanks to a note by community user
[@&#8203;thompson-tomo](https://github.com/thompson-tomo) FusionCache
now multi-targets different .NET vesions.
This was not needed per-se, but by doing it FusionCache can now have
[less
dependencies](https://www.nuget.org/packages/ZiggyCreatures.FusionCache/#dependencies-body-tab)
for some TFMs.

See [here](https://github.com/ZiggyCreatures/FusionCache/issues/230)
for the original issue.

#### 🚀 Better perf for FusionCacheProvider
([docs](https://github.com/ZiggyCreatures/FusionCache/blob/main/docs/NamedCaches.md))

Community user [@&#8203;0xced](https://github.com/0xced) contributed
with a [PR](https://github.com/ZiggyCreatures/FusionCache/pull/249)
that improved the performance of FusionCacheProvider, used with Named
Caches.

See [here](https://github.com/ZiggyCreatures/FusionCache/pull/249) for
the original PR.

#### ⚠️ Update dependencies for
[CVE-2024-30105](https://github.com/advisories/GHSA-hh2w-p6rv-4g7w)

Communicty user [@&#8203;dependabot](https://github.com/dependabot)
(😅) noticed CVE-2024-30105 and promptly bumped the referenced version of
the System.Text.Json package.

Note that this is only related to the package
[ZiggyCreatures.FusionCache.Serialization.SystemTextJson](https://www.nuget.org/packages/ZiggyCreatures.FusionCache.Serialization.SystemTextJson/).

#### ✅ Better tests

Some tests have been added for each new feature, and overall better
snapshot tests.

#### 📕 Docs

Updated some docs with the latest new things.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 7am on Sunday,before 7am on
Wednesday" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job
log](https://developer.mend.io/github/digdir/dialogporten).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ole Jørgen Skogstad <[email protected]>
  • Loading branch information
renovate[bot] and oskogstad authored Aug 14, 2024
1 parent aac9e91 commit ce633dc
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.0"/>
<PackageReference Include="Polly.Contrib.WaitAndRetry" Version="1.1.1"/>
<PackageReference Include="ZiggyCreatures.FusionCache" Version="1.2.0"/>
<PackageReference Include="ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis" Version="1.2.0"/>
<PackageReference Include="ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack" Version="1.2.0"/>
<PackageReference Include="ZiggyCreatures.FusionCache" Version="1.3.0"/>
<PackageReference Include="ZiggyCreatures.FusionCache.Backplane.StackExchangeRedis" Version="1.3.0" />
<PackageReference Include="ZiggyCreatures.FusionCache.Serialization.NeueccMessagePack" Version="1.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit ce633dc

Please sign in to comment.