Skip to content

Commit 0e26383

Browse files
authored
Merge pull request #13 from PandaTechAM/development
Extensions fix
2 parents 260c356 + dd14332 commit 0e26383

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

src/DistributedCache/DistributedCache.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
<PackageReadmeFile>Readme.md</PackageReadmeFile>
99
<Authors>Pandatech</Authors>
1010
<Copyright>MIT</Copyright>
11-
<Version>4.0.3</Version>
11+
<Version>4.0.4</Version>
1212
<PackageId>Pandatech.DistributedCache</PackageId>
1313
<Title>Pandatech Distributed Cache</Title>
1414
<PackageTags>pandatech;cache;hybrid-cache;distributed-cahce;message-pack;rate-limiting;redis-lock;redis;fusion-cache</PackageTags>
1515
<Description>Pandatech.DistributedCache is a lightweight .NET library that extends the new HybridCache abstraction for seamless distributed caching on top of Redis. It provides strongly typed caching with MessagePack serialization, distributed locking, rate limiting, and stampede protection. With fewer than 500 lines of code, it is both easy to understand and simple to adopt, while still offering robust features for production environments.</Description>
1616
<RepositoryUrl>https://github.com/PandaTechAM/be-lib-distributed-cache</RepositoryUrl>
17-
<PackageReleaseNotes>TimeSpan max value support</PackageReleaseNotes>
17+
<PackageReleaseNotes>Extension update</PackageReleaseNotes>
1818
</PropertyGroup>
1919

2020
<ItemGroup>

src/DistributedCache/Extensions/StringExtensions.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,28 @@ namespace DistributedCache.Extensions;
44

55
public static class StringExtensions
66
{
7-
public static string PrefixWith(this string value, string prefix)
8-
{
9-
return $"{prefix}{value}";
10-
}
117

12-
public static string PrefixWith(this string value, Assembly assembly)
8+
public static string PrefixWithAssemblyName(this string value)
139
{
14-
return $"{assembly.GetName().Name}:{value}";
10+
var assembly = Assembly.GetCallingAssembly();
11+
return value.PrefixWith(assembly.GetName()
12+
.Name!);
1513
}
1614

17-
public static List<string> PrefixWith(this IEnumerable<string> values, string prefix)
15+
public static List<string> PrefixWithAssemblyName(this IEnumerable<string> values)
1816
{
19-
return values.Select(x => x.PrefixWith(prefix))
17+
var assembly = Assembly.GetCallingAssembly().GetName().Name;
18+
return values.Select(x => x.PrefixWith(assembly!))
2019
.ToList();
2120
}
2221

23-
public static List<string> PrefixWith(this IEnumerable<string> values, Assembly assembly)
22+
public static string PrefixWith(this string value, string prefix)
23+
{
24+
return $"{prefix}{value}";
25+
}
26+
public static List<string> PrefixWith(this IEnumerable<string> values, string prefix)
2427
{
25-
return values.Select(x => x.PrefixWith(assembly))
28+
return values.Select(x => x.PrefixWith(prefix))
2629
.ToList();
2730
}
2831
}

0 commit comments

Comments
 (0)