Skip to content

Commit ce8191f

Browse files
committed
fix: GetCountAsync(string prefix) #306 Thanks to @rendyu
1 parent 2ba7c47 commit ce8191f

File tree

5 files changed

+141
-139
lines changed

5 files changed

+141
-139
lines changed

src/Senparc.CO2NET.Cache.CsRedis/ObjectCacheStrategy/RedisHashSetObjectCacheStrategy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ public override Task<long> GetCountAsync()
480480

481481
public override Task<long> GetCountAsync(string prefix)
482482
{
483-
return Task.Factory.StartNew(() => GetCount(""));
483+
return Task.Factory.StartNew(() => GetCount(prefix));
484484
}
485485

486486
/// <summary>

src/Senparc.CO2NET.Cache.CsRedis/ObjectCacheStrategy/RedisObjectCacheStrategy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ public override Task<long> GetCountAsync()
352352
}
353353
public override Task<long> GetCountAsync(string prefix)
354354
{
355-
return Task.Factory.StartNew(() => GetCount(""));
355+
return Task.Factory.StartNew(() => GetCount(prefix));
356356
}
357357
public override async Task SetAsync(string key, object value, TimeSpan? expiry = null, bool isFullKey = false)
358358
{
Lines changed: 64 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,76 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
4-
<Version>2.0.0-beta1</Version>
5-
<AssemblyName>Senparc.CO2NET.Cache.CsRedis</AssemblyName>
6-
<RootNamespace>Senparc.CO2NET.Cache.CsRedis</RootNamespace>
7-
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
8-
<Description>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
4+
<Version>2.0.1-beta1</Version>
5+
<AssemblyName>Senparc.CO2NET.Cache.CsRedis</AssemblyName>
6+
<RootNamespace>Senparc.CO2NET.Cache.CsRedis</RootNamespace>
7+
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
8+
<Description>
99
CONET cache strategy - Redis module
1010

1111
CO2NET open source project:
1212
https://github.com/Senparc/Senparc.CO2NET
1313
</Description>
14-
<Copyright>Senparc Copyright © 2004~2024</Copyright>
15-
<PackageTags>Senparc.CO2NET,Cache,Redis,CO2NET,盛派</PackageTags>
16-
<Authors>Jeffrey Su</Authors>
17-
<Owners>Senparc</Owners>
18-
<PackageLicenseUrl>https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md</PackageLicenseUrl>
19-
<ProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</ProjectUrl>
20-
<Title>Senparc.CO2NET.Cache.CsRedis.dll</Title>
21-
<Summary>CsRedis Cache for CO2NET C#</Summary>
22-
<PackageProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</PackageProjectUrl>
23-
<PackageIcon>icon.jpg</PackageIcon>
24-
<PackageReleaseNotes>
14+
<Copyright>Senparc Copyright © 2004~2024</Copyright>
15+
<PackageTags>Senparc.CO2NET,Cache,Redis,CO2NET,盛派</PackageTags>
16+
<Authors>Jeffrey Su</Authors>
17+
<Owners>Senparc</Owners>
18+
<PackageLicenseUrl>https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md</PackageLicenseUrl>
19+
<ProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</ProjectUrl>
20+
<Title>Senparc.CO2NET.Cache.CsRedis.dll</Title>
21+
<Summary>CsRedis Cache for CO2NET C#</Summary>
22+
<PackageProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</PackageProjectUrl>
23+
<PackageIcon>icon.jpg</PackageIcon>
24+
<PackageReleaseNotes>
2525
v0.1.0 Genesis
2626
v0.5.2 BaseRedisObjectCacheStrategy destructor performs null value check and adds "#{Cache_Redis_Configuration}#" filter check
2727
v1.1.4 RedisObjectCacheStrategy and RedisHashSetObjectCacheStrategy.Get() methods add pure string check
2828
v1.2.5 Fix bug where GetAllByPrefixAsync(key) method automatically retrieves all keys
2929
[2024-09-11] v1.2.6 Update Cache, remove InsertToCache(), add Count(prefix)
30+
[2024-10-24] v2.0.1-beta1 fix: GetCountAsync(string prefix) #306 Thanks to @rendyu
3031
</PackageReleaseNotes>
31-
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
32-
<Configurations>Debug;Release;Test</Configurations>
33-
</PropertyGroup>
34-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
35-
<OutputPath>..\BuildOutPut</OutputPath>
36-
<DefineConstants>TRACE</DefineConstants>
37-
</PropertyGroup>
38-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
39-
<OutputPath>..\..\BuildOutPut</OutputPath>
40-
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
41-
<DocumentationFile>..\BuildOutPut\Senparc.CO2NET.Cache.CsRedis.XML</DocumentationFile>
42-
<Optimize>true</Optimize>
43-
<DebugType>pdbonly</DebugType>
44-
<ErrorReport>prompt</ErrorReport>
45-
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
46-
</PropertyGroup>
47-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net462|AnyCPU'">
48-
<OutputPath>..\BuildOutPut\</OutputPath>
49-
<DocumentationFile>..\BuildOutPut\net462\Senparc.CO2NET.Cache.CsRedis.xml</DocumentationFile>
50-
</PropertyGroup>
51-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
52-
<OutputPath>..\BuildOutPut\</OutputPath>
53-
<DocumentationFile>..\BuildOutPut\netstandard2.0\Senparc.CO2NET.Cache.CsRedis.xml</DocumentationFile>
54-
</PropertyGroup>
55-
<ItemGroup>
56-
<None Include="..\Senparc.CO2NET\icon.jpg" Pack="true" Visible="false" PackagePath="" />
57-
</ItemGroup>
58-
<ItemGroup>
59-
<Compile Remove="packages\**" />
60-
<Compile Remove="ServiceStack.Redis\**" />
61-
<EmbeddedResource Remove="packages\**" />
62-
<EmbeddedResource Remove="ServiceStack.Redis\**" />
63-
<None Remove="packages\**" />
64-
<None Remove="ServiceStack.Redis\**" />
65-
</ItemGroup>
66-
<ItemGroup>
67-
<!--<PackageReference Include="Senparc.CO2NET.Cache.Redis.RedLock" Version="0.1.0" />-->
68-
<PackageReference Include="BinaryFormatter" Version="2.1.4" />
69-
<PackageReference Include="CSRedisCore" Version="3.8.800" />
70-
</ItemGroup>
71-
<ItemGroup>
72-
<ProjectReference Include="..\Senparc.CO2NET.Cache.CsRedis.RedLock\redlock-cs\src\Senparc.CO2NET.Cache.CsRedis.RedLock.csproj" />
73-
<ProjectReference Include="..\Senparc.CO2NET\Senparc.CO2NET.csproj" />
74-
</ItemGroup>
32+
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
33+
<Configurations>Debug;Release;Test</Configurations>
34+
</PropertyGroup>
35+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
36+
<OutputPath>..\BuildOutPut</OutputPath>
37+
<DefineConstants>TRACE</DefineConstants>
38+
</PropertyGroup>
39+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
40+
<OutputPath>..\..\BuildOutPut</OutputPath>
41+
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
42+
<DocumentationFile>..\BuildOutPut\Senparc.CO2NET.Cache.CsRedis.XML</DocumentationFile>
43+
<Optimize>true</Optimize>
44+
<DebugType>pdbonly</DebugType>
45+
<ErrorReport>prompt</ErrorReport>
46+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
47+
</PropertyGroup>
48+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net462|AnyCPU'">
49+
<OutputPath>..\BuildOutPut\</OutputPath>
50+
<DocumentationFile>..\BuildOutPut\net462\Senparc.CO2NET.Cache.CsRedis.xml</DocumentationFile>
51+
</PropertyGroup>
52+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
53+
<OutputPath>..\BuildOutPut\</OutputPath>
54+
<DocumentationFile>..\BuildOutPut\netstandard2.0\Senparc.CO2NET.Cache.CsRedis.xml</DocumentationFile>
55+
</PropertyGroup>
56+
<ItemGroup>
57+
<None Include="..\Senparc.CO2NET\icon.jpg" Pack="true" Visible="false" PackagePath="" />
58+
</ItemGroup>
59+
<ItemGroup>
60+
<Compile Remove="packages\**" />
61+
<Compile Remove="ServiceStack.Redis\**" />
62+
<EmbeddedResource Remove="packages\**" />
63+
<EmbeddedResource Remove="ServiceStack.Redis\**" />
64+
<None Remove="packages\**" />
65+
<None Remove="ServiceStack.Redis\**" />
66+
</ItemGroup>
67+
<ItemGroup>
68+
<!--<PackageReference Include="Senparc.CO2NET.Cache.Redis.RedLock" Version="0.1.0" />-->
69+
<PackageReference Include="BinaryFormatter" Version="2.1.4" />
70+
<PackageReference Include="CSRedisCore" Version="3.8.800" />
71+
</ItemGroup>
72+
<ItemGroup>
73+
<ProjectReference Include="..\Senparc.CO2NET.Cache.CsRedis.RedLock\redlock-cs\src\Senparc.CO2NET.Cache.CsRedis.RedLock.csproj" />
74+
<ProjectReference Include="..\Senparc.CO2NET\Senparc.CO2NET.csproj" />
75+
</ItemGroup>
7576
</Project>

src/Senparc.CO2NET.Cache.Redis/ObjectCacheStrategy/RedisHashSetObjectCacheStrategy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ public override Task<long> GetCountAsync()
485485
}
486486
public override Task<long> GetCountAsync(string prefix)
487487
{
488-
return Task.Factory.StartNew(() => GetCount(""));
488+
return Task.Factory.StartNew(() => GetCount(prefix));
489489
}
490490

491491
/// <summary>

src/Senparc.CO2NET.Cache.Redis/Senparc.CO2NET.Cache.Redis.csproj

Lines changed: 74 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
4-
<Version>5.0.0-beta1</Version>
5-
<AssemblyName>Senparc.CO2NET.Cache.Redis</AssemblyName>
6-
<RootNamespace>Senparc.CO2NET.Cache.Redis</RootNamespace>
7-
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
8-
<Description>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
4+
<Version>5.0.1-beta1</Version>
5+
<AssemblyName>Senparc.CO2NET.Cache.Redis</AssemblyName>
6+
<RootNamespace>Senparc.CO2NET.Cache.Redis</RootNamespace>
7+
<GeneratePackageOnBuild Condition=" '$(Configuration)' == 'Release' ">true</GeneratePackageOnBuild>
8+
<Description>
99
WeChat Public Account - Redis Module
1010

1111
Senparc.Weixin SDK Open Source Project:
1212
https://github.com/JeffreySu/WeiXinMPSDK
1313
</Description>
14-
<Copyright>Senparc Copyright © 2004~2024</Copyright>
15-
<PackageTags>Senparc.CO2NET,Cache,Redis,CO2NET,盛派</PackageTags>
16-
<Authors>Jeffrey Su</Authors>
17-
<Owners>Senparc</Owners>
18-
<PackageLicenseUrl>https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md</PackageLicenseUrl>
19-
<ProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</ProjectUrl>
20-
<Title>Senparc.CO2NET.Cache.Redis.dll</Title>
21-
<Summary>Redis Cache(StackExchange) for CO2NET C#</Summary>
22-
<PackageProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</PackageProjectUrl>
23-
<PackageIcon>icon.jpg</PackageIcon>
24-
<PackageReleaseNotes>
14+
<Copyright>Senparc Copyright © 2004~2024</Copyright>
15+
<PackageTags>Senparc.CO2NET,Cache,Redis,CO2NET,盛派</PackageTags>
16+
<Authors>Jeffrey Su</Authors>
17+
<Owners>Senparc</Owners>
18+
<PackageLicenseUrl>https://github.com/JeffreySu/WeiXinMPSDK/blob/master/license.md</PackageLicenseUrl>
19+
<ProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</ProjectUrl>
20+
<Title>Senparc.CO2NET.Cache.Redis.dll</Title>
21+
<Summary>Redis Cache(StackExchange) for CO2NET C#</Summary>
22+
<PackageProjectUrl>https://github.com/JeffreySu/WeiXinMPSDK</PackageProjectUrl>
23+
<PackageIcon>icon.jpg</PackageIcon>
24+
<PackageReleaseNotes>
2525
v0.1.0
2626
Provide distributed cache support
2727
Due to a bug in the StackExchange.Redis library, the .NET 4.0 version is temporarily not provided
@@ -104,61 +104,62 @@
104104
v4.1.3 Add pure string check to RedisObjectCacheStrategy and RedisHashSetObjectCacheStrategy.Get() methods
105105
v4.2.5 Fix bug where GetAllByPrefixAsync(key) method would automatically retrieve all keys
106106

107-
[2024-09-11] v4.2.6 Update Cache, remove InsertToCache(), add Count(prefix)
107+
[2024-09-11] v4.2.6 Update Cache, remove InsertToCache(), add Count(prefix)
108+
[2024-10-24] v5.0.1-beta1 fix: GetCountAsync(string prefix) #306 Thanks to @rendyu
108109
</PackageReleaseNotes>
109-
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
110-
<Configurations>Debug;Release;Test</Configurations>
111-
</PropertyGroup>
112-
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
113-
<OutputPath>..\BuildOutPut</OutputPath>
114-
<DefineConstants>TRACE</DefineConstants>
115-
</PropertyGroup>
116-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
117-
<OutputPath>..\..\BuildOutPut</OutputPath>
118-
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
119-
<DocumentationFile>..\BuildOutPut\Senparc.CO2NET.Cache.Redis.XML</DocumentationFile>
120-
<Optimize>true</Optimize>
121-
<DebugType>pdbonly</DebugType>
122-
<ErrorReport>prompt</ErrorReport>
123-
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
124-
</PropertyGroup>
125-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net462|AnyCPU'">
126-
<OutputPath>..\BuildOutPut\</OutputPath>
127-
<DocumentationFile>..\BuildOutPut\net462\Senparc.CO2NET.Cache.Redis.xml</DocumentationFile>
128-
</PropertyGroup>
129-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
130-
<OutputPath>..\BuildOutPut\</OutputPath>
131-
<DocumentationFile>..\BuildOutPut\netstandard2.0\Senparc.CO2NET.Cache.Redis.xml</DocumentationFile>
132-
</PropertyGroup>
133-
<ItemGroup>
134-
<None Include="..\Senparc.CO2NET\icon.jpg" Pack="true" Visible="false" PackagePath="" />
135-
</ItemGroup>
136-
<ItemGroup>
137-
<Compile Remove="packages\**" />
138-
<Compile Remove="ServiceStack.Redis\**" />
139-
<EmbeddedResource Remove="packages\**" />
140-
<EmbeddedResource Remove="ServiceStack.Redis\**" />
141-
<None Remove="packages\**" />
142-
<None Remove="ServiceStack.Redis\**" />
143-
</ItemGroup>
144-
<ItemGroup>
145-
<!--<PackageReference Include="Senparc.CO2NET.Cache.Redis.RedLock" Version="0.1.0" />-->
146-
<PackageReference Include="BinaryFormatter" Version="2.1.4" />
147-
</ItemGroup>
148-
<ItemGroup>
149-
<PackageReference Include="StackExchange.Redis" Version="2.7.4" />
150-
</ItemGroup>
151-
<!--<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
110+
<RepositoryUrl>https://github.com/Senparc/Senparc.CO2NET</RepositoryUrl>
111+
<Configurations>Debug;Release;Test</Configurations>
112+
</PropertyGroup>
113+
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
114+
<OutputPath>..\BuildOutPut</OutputPath>
115+
<DefineConstants>TRACE</DefineConstants>
116+
</PropertyGroup>
117+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
118+
<OutputPath>..\..\BuildOutPut</OutputPath>
119+
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
120+
<DocumentationFile>..\BuildOutPut\Senparc.CO2NET.Cache.Redis.XML</DocumentationFile>
121+
<Optimize>true</Optimize>
122+
<DebugType>pdbonly</DebugType>
123+
<ErrorReport>prompt</ErrorReport>
124+
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
125+
</PropertyGroup>
126+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net462|AnyCPU'">
127+
<OutputPath>..\BuildOutPut\</OutputPath>
128+
<DocumentationFile>..\BuildOutPut\net462\Senparc.CO2NET.Cache.Redis.xml</DocumentationFile>
129+
</PropertyGroup>
130+
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
131+
<OutputPath>..\BuildOutPut\</OutputPath>
132+
<DocumentationFile>..\BuildOutPut\netstandard2.0\Senparc.CO2NET.Cache.Redis.xml</DocumentationFile>
133+
</PropertyGroup>
134+
<ItemGroup>
135+
<None Include="..\Senparc.CO2NET\icon.jpg" Pack="true" Visible="false" PackagePath="" />
136+
</ItemGroup>
137+
<ItemGroup>
138+
<Compile Remove="packages\**" />
139+
<Compile Remove="ServiceStack.Redis\**" />
140+
<EmbeddedResource Remove="packages\**" />
141+
<EmbeddedResource Remove="ServiceStack.Redis\**" />
142+
<None Remove="packages\**" />
143+
<None Remove="ServiceStack.Redis\**" />
144+
</ItemGroup>
145+
<ItemGroup>
146+
<!--<PackageReference Include="Senparc.CO2NET.Cache.Redis.RedLock" Version="0.1.0" />-->
147+
<PackageReference Include="BinaryFormatter" Version="2.1.4" />
148+
</ItemGroup>
149+
<ItemGroup>
150+
<PackageReference Include="StackExchange.Redis" Version="2.7.4" />
151+
</ItemGroup>
152+
<!--<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.6' ">
152153
<PackageReference Include="protobuf-net" Version="2.1.0" />
153154
</ItemGroup>-->
154-
<ItemGroup>
155-
<Compile Remove="Properties\AssemblyInfo.cs" />
156-
</ItemGroup>
157-
<ItemGroup>
158-
<Folder Include="Properties\" />
159-
</ItemGroup>
160-
<ItemGroup>
161-
<ProjectReference Include="..\Senparc.CO2NET.Cache.Redis.RedLock\redlock-cs\src\Senparc.CO2NET.Cache.Redis.RedLock.csproj" />
162-
<ProjectReference Include="..\Senparc.CO2NET\Senparc.CO2NET.csproj" />
163-
</ItemGroup>
155+
<ItemGroup>
156+
<Compile Remove="Properties\AssemblyInfo.cs" />
157+
</ItemGroup>
158+
<ItemGroup>
159+
<Folder Include="Properties\" />
160+
</ItemGroup>
161+
<ItemGroup>
162+
<ProjectReference Include="..\Senparc.CO2NET.Cache.Redis.RedLock\redlock-cs\src\Senparc.CO2NET.Cache.Redis.RedLock.csproj" />
163+
<ProjectReference Include="..\Senparc.CO2NET\Senparc.CO2NET.csproj" />
164+
</ItemGroup>
164165
</Project>

0 commit comments

Comments
 (0)