Skip to content

Commit fb26207

Browse files
Create distributed cache implementation of IDistributedCache using PostgreSQL
* feat: create extensions caching postgresql * fix: run ci any branch * fix: upload artifact version * docs: update supported versions * fix: review copilot --------- Co-authored-by: Alisson Solitto <alisson.solitto>
1 parent 75f2792 commit fb26207

35 files changed

+3408
-348
lines changed

.editorconfig

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Default settings:
7+
# A newline ending every file
8+
# Use 4 spaces as indentation
9+
[*]
10+
insert_final_newline = true
11+
indent_style = space
12+
indent_size = 4
13+
trim_trailing_whitespace = true
14+
15+
# C# files
16+
[*.cs]
17+
charset = utf-8
18+
19+
# New line preferences
20+
csharp_new_line_before_open_brace = all
21+
csharp_new_line_before_else = true
22+
csharp_new_line_before_catch = true
23+
csharp_new_line_before_finally = true
24+
csharp_new_line_before_members_in_object_initializers = true
25+
csharp_new_line_before_members_in_anonymous_types = true
26+
csharp_new_line_between_query_expression_clauses = true
27+
28+
# Indentation preferences
29+
csharp_indent_block_contents = true
30+
csharp_indent_braces = false
31+
csharp_indent_case_contents = true
32+
csharp_indent_case_contents_when_block = true
33+
csharp_indent_switch_labels = true
34+
csharp_indent_labels = one_less_than_current
35+
36+
# Modifier preferences
37+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
38+
39+
# avoid this. unless absolutely necessary
40+
dotnet_style_qualification_for_field = false:suggestion
41+
dotnet_style_qualification_for_property = false:suggestion
42+
dotnet_style_qualification_for_method = false:suggestion
43+
dotnet_style_qualification_for_event = false:suggestion
44+
45+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
46+
csharp_style_var_for_built_in_types = false:suggestion
47+
csharp_style_var_when_type_is_apparent = true:suggestion
48+
csharp_style_var_elsewhere = false:suggestion
49+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
50+
dotnet_style_predefined_type_for_member_access = true:suggestion
51+
52+
# name all constant fields using PascalCase
53+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
54+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
55+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
56+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
57+
dotnet_naming_symbols.constant_fields.required_modifiers = const
58+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
59+
60+
# static fields should have s_ prefix
61+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
62+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
63+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
64+
dotnet_naming_symbols.static_fields.applicable_kinds = field
65+
dotnet_naming_symbols.static_fields.required_modifiers = static
66+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
67+
dotnet_naming_style.static_prefix_style.required_prefix = s_
68+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
69+
70+
# internal and private fields should be _camelCase
71+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
72+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
73+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
74+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
75+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
76+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
77+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
78+
79+
# Code style defaults
80+
csharp_using_directive_placement = outside_namespace:suggestion
81+
dotnet_sort_system_directives_first = true
82+
csharp_prefer_braces = true:suggestion
83+
csharp_preserve_single_line_blocks = true:none
84+
csharp_preserve_single_line_statements = false:none
85+
csharp_prefer_static_local_function = true:suggestion
86+
csharp_prefer_simple_using_statement = false:none
87+
csharp_style_prefer_switch_expression = true:suggestion
88+
dotnet_style_readonly_field = true:suggestion
89+
90+
# Expression-level preferences
91+
dotnet_style_object_initializer = true:suggestion
92+
dotnet_style_collection_initializer = true:suggestion
93+
dotnet_style_explicit_tuple_names = true:suggestion
94+
dotnet_style_coalesce_expression = true:suggestion
95+
dotnet_style_null_propagation = true:suggestion
96+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
97+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
98+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
99+
dotnet_style_prefer_auto_properties = true:suggestion
100+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
101+
dotnet_style_prefer_conditional_expression_over_return = true:silent
102+
csharp_prefer_simple_default_expression = true:suggestion
103+
104+
# XML project files
105+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
106+
indent_size = 2
107+
108+
# XML config files
109+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
110+
indent_size = 2
111+
112+
# YAML config files
113+
[*.{yml,yaml}]
114+
indent_size = 2
115+
116+
# JSON files
117+
[*.json]
118+
indent_size = 2
119+
120+
# Shell scripts
121+
[*.sh]
122+
end_of_line = lf
123+
124+
[*.{cmd,bat}]
125+
end_of_line = crlf
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Bug Report
2+
description: File a bug report
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this bug report!
10+
- type: input
11+
id: version
12+
attributes:
13+
label: Version
14+
description: What version of our package are you using?
15+
placeholder: 1.0.0
16+
validations:
17+
required: true
18+
- type: dropdown
19+
id: dotnet-version
20+
attributes:
21+
label: .NET Version
22+
description: What version of .NET are you using?
23+
options:
24+
- .NET 6.0
25+
- .NET 7.0
26+
- .NET 8.0
27+
- .NET 9.0
28+
- Other (please specify in description)
29+
validations:
30+
required: true
31+
- type: dropdown
32+
id: postgres-version
33+
attributes:
34+
label: PostgreSQL Version
35+
description: What version of PostgreSQL are you using?
36+
options:
37+
- PostgreSQL 13
38+
- PostgreSQL 14
39+
- PostgreSQL 15
40+
- PostgreSQL 16
41+
- Other (please specify in description)
42+
validations:
43+
required: true
44+
- type: textarea
45+
id: what-happened
46+
attributes:
47+
label: What happened?
48+
description: Also tell us, what did you expect to happen?
49+
placeholder: Tell us what you see!
50+
validations:
51+
required: true
52+
- type: textarea
53+
id: reproduction
54+
attributes:
55+
label: Reproduction steps
56+
description: How can we reproduce this issue?
57+
placeholder: |
58+
1. Configure the cache with...
59+
2. Call method X with parameters...
60+
3. Observe error...
61+
validations:
62+
required: true
63+
- type: textarea
64+
id: logs
65+
attributes:
66+
label: Relevant log output
67+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
68+
render: shell
69+
- type: checkboxes
70+
id: terms
71+
attributes:
72+
label: Code of Conduct
73+
description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com/codeofconduct)
74+
options:
75+
- label: I agree to follow this project's Code of Conduct
76+
required: true
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Feature Request
2+
description: Suggest an idea for this project
3+
title: "[Feature]: "
4+
labels: ["enhancement"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this feature request!
10+
- type: textarea
11+
id: problem
12+
attributes:
13+
label: Problem Statement
14+
description: Is your feature request related to a problem? Please describe.
15+
placeholder: I'm always frustrated when [...]
16+
validations:
17+
required: true
18+
- type: textarea
19+
id: solution
20+
attributes:
21+
label: Proposed Solution
22+
description: Describe the solution you'd like
23+
placeholder: I would like to see [...]
24+
validations:
25+
required: true
26+
- type: textarea
27+
id: alternatives
28+
attributes:
29+
label: Alternatives Considered
30+
description: Describe alternatives you've considered
31+
placeholder: I've also thought about [...]
32+
- type: textarea
33+
id: context
34+
attributes:
35+
label: Additional context
36+
description: Add any other context or screenshots about the feature request here.
37+
- type: checkboxes
38+
id: terms
39+
attributes:
40+
label: Code of Conduct
41+
description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com/codeofconduct)
42+
options:
43+
- label: I agree to follow this project's Code of Conduct
44+
required: true

.github/pull_request_template.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Pull Request Template
2+
description: Template for creating a pull request
3+
4+
about: Provide information about the changes you're proposing
5+
6+
---
7+
8+
## Description
9+
Please include a summary of the change and which issue it fixes. Include relevant motivation, context, and any dependencies that are required for this change.
10+
11+
Fixes # (issue)
12+
13+
## Type of change
14+
Please delete options that are not relevant.
15+
16+
- [ ] Bug fix (non-breaking change which fixes an issue)
17+
- [ ] New feature (non-breaking change which adds functionality)
18+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
19+
- [ ] Documentation update
20+
21+
## How Has This Been Tested?
22+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration.
23+
24+
- [ ] Test A
25+
- [ ] Test B
26+
27+
## Checklist:
28+
- [ ] My code follows the style guidelines of this project
29+
- [ ] I have performed a self-review of my own code
30+
- [ ] I have commented my code, particularly in hard-to-understand areas
31+
- [ ] I have made corresponding changes to the documentation
32+
- [ ] My changes generate no new warnings
33+
- [ ] I have added tests that prove my fix is effective or that my feature works
34+
- [ ] New and existing unit tests pass locally with my changes
35+
- [ ] I have updated the CHANGELOG.md with details of my changes

.github/workflows/ci.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build & Test
2+
3+
on:
4+
push:
5+
branches: [ "**" ]
6+
pull_request:
7+
branches: [ "**" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
services:
13+
postgres:
14+
image: postgres:16
15+
env:
16+
POSTGRES_DB: cache_test
17+
POSTGRES_USER: postgres
18+
POSTGRES_PASSWORD: postgres
19+
ports:
20+
- 5432:5432
21+
options: >-
22+
--health-cmd "pg_isready -U postgres" --health-interval 10s --health-timeout 5s --health-retries 5
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
- name: Setup .NET
28+
uses: actions/setup-dotnet@v4
29+
with:
30+
dotnet-version: |
31+
6.0.x
32+
8.0.x
33+
9.0.x
34+
- name: Restore dependencies
35+
run: dotnet restore
36+
- name: Build
37+
run: dotnet build --no-restore --configuration Release
38+
- name: Test
39+
env:
40+
PGCACHE_TEST_DB: cache_test
41+
PGCACHE_TEST_USER: postgres
42+
PGCACHE_TEST_PASS: postgres
43+
PGCACHE_TEST_HOST: localhost
44+
PGCACHE_TEST_PORT: 5432
45+
PGCACHE_TEST_TABLE: cache_items_test
46+
run: dotnet test --no-build --configuration Release --verbosity normal
47+
- name: Pack
48+
run: dotnet pack --no-build --configuration Release --output ./artifacts
49+
- name: Upload NuGet packages
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: nuget-packages
53+
path: ./artifacts/*.nupkg
54+
- name: Upload symbol packages
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: symbol-packages
58+
path: ./artifacts/*.snupkg

0 commit comments

Comments
 (0)