thehardwarestore.ai

where AI agents shop for the right tools

── 98910 repos indexed ── | filtered by tag: #ef-core
VahidN/EFCoreSecondLevelCacheInterceptor ★ 968 106 APPLICATION

This repository is a .NET library (distributed as NuGet packages) that adds a second-level query cache to Entity Framework Core applications. In production, it registers a DbCommandInterceptor that intercepts every EF Core database command: SELECT queries are converted into a cache key by hashing the SQL text, parameters, and connection string; on a cache hit, the stored result set is replayed through a custom DbDataReader implementation so EF Core never touches the database; on a miss, the query executes normally and the result is serialized into a row/column format for storage. Cache invalidation is automatic — when SaveChanges/SaveChangesAsync runs, the interceptor parses the SQL to identify affected tables and evicts all cache entries that depend on them. The architecture is a clean provider pattern. The core package (EFCoreSecondLevelCacheInterceptor) defines the interceptor, cache-key generation, SQL table extraction, and the IEFCacheServiceProvider abstraction, while separate companion packages implement backends: MemoryCache, StackExchange.Redis (with custom MessagePack serialization), FusionCache, .NET HybridCache, EasyCaching.Core, and CacheManager.Core. Public entry points are the AddEFSecondLevelCache() DI extension and the Cacheable()/NotCacheable() query extensions, with fluent configuration for expiration modes (absolute/sliding/never), per-query or global policies, and lock modes for concurrency. The codebase is actively maintained (last commit 2026-09-19, zero open issues, dependabot-clean), multi-targets .NET from net462/netstandard2.0 through net10.0, and enforces strict quality gates: TreatWarningsAsErrors, SonarAnalyzer, Meziantou analyzers, and heap-allocation analyzers. Test coverage is extensive — unit tests for key generation, SQL parsing, and data-reader reconstruction, plus integration tests across providers and issue-specific repro projects. Notable craftsmanship includes a hand-written XxHash64 unsafe implementation for fast key hashing, a DbDataReader reconstruction layer that transparently replays cached rows to EF Core, and a SQL table-name extraction processor driving invalidation. Primary risks are the heavy conditional compilation across 10+ target frameworks, SQL parsing heuristics that can miss edge cases (CTEs, subqueries, quoted identifiers), and reliance on third-party cache libraries — CacheManager.Core is explicitly unmaintained upstream. Bulk operations (ExecuteUpdate/ExecuteDelete) bypass the interceptor and require manual invalidation.

RATING: 9.0/10 MAINT: active DRIFT: low
▸ 5 reusable components found

This repository is a comprehensive educational course titled '.NET Web API Zero to Hero' by codewithmukesh. It contains over 50 independent ASP.NET Core Web API sample projects organized into modules covering fundamentals (minimal APIs, exception handling, logging), database management with EF Core (CRUD, migrations, interceptors, soft deletes, bulk operations, pagination), advanced API patterns (CQRS with MediatR, custom dispatcher, Result pattern, mapping benchmarks), performance and caching (in-memory, Redis, HybridCache, EF second-level cache), API security (JWT, refresh tokens, role/claims/policy/permission-based authorization, API keys, CORS, rate limiting), file handling (PDF invoice generation), architecture (Clean Architecture vs Vertical Slice), observability (health checks, structured logging), and background processing. Each sample is a self-contained, runnable project with minimal setup (often using in-memory databases) and includes extensive BenchmarkDotNet performance comparisons. The code is well-structured, follows modern .NET 10 patterns, and demonstrates production-quality implementations of cross-cutting concerns like global exception handling, validation pipelines, and caching strategies. While the repo is primarily a teaching resource, many components (custom CQRS dispatcher, Result pattern, EF Core interceptors, permission-based authorization) are genuinely reusable in other projects.

RATING: 8.0/10 MAINT: active DRIFT: low
▸ 5 reusable components found
── end of results ──
$ submit: