Git Product home page Git Product logo

caching-mysql's Issues

Auto detect database field from ConnectionString to be used as schema name if it exists

Currently MySqlCacheOptions requires SchemaName to be provided to work, which seems like it is designed for generic SQL implementations rather than specific to MySQL.

It makes sense for a generic SQL implementation to require a SchemaName field as database and schema are different; however in MySQL database is synonymous with schema (and is the only major SQL engine that does this IIRC), which can be specified in the connection string with the Database field. If I have provided a Database field in my connection string, I'm already connected to a specific database; further asking me to provide a SchemaName would be a unnecessary separation/duplication of data.

This is particularly strange as Pomelo.EntityFrameworkCore.MySql only uses a single connection string with Database field filled in. So by using both libraries I'm forced to handle connection strings in two different ways.

I believe DbConnectionStringBuilder can be used for this purpose.

.NET Standard 2.0

Is it possible to support multiple TargetFrameworks?
It would be great if Pomelo.Extensions.Caching.MySql targeted .NET Standard 2.0 as well.
We are currently using Pomelo.Extensions.Caching.MySql version 2.0.3 with .NET Framework 4.8, and we need the latest version of MySqlConnector, but unfortunately we cannot just update it due to their breaking changes in version 1.0.0,
and we cannot update Pomelo.Extensions.Caching.MySql because now it targets .net standard 2.1

SetAsync ignoring DefaultSlidingExpiration set in MySqlCacheOptions

using Pomelo.Extensions.Caching.MySql version 2.1.3

DI:

services.AddDistributedMySqlCache(opts =>
            {
                opts.ConnectionString = config.GetConnectionString("DistributedCache");
                opts.SchemaName = "DistributedCache";
                opts.TableName = "ApiCache";
                opts.DefaultSlidingExpiration = TimeSpan.FromMinutes(10);
            });

Usage:

_cache.Set(  "my_key", Encoding.UTF8.GetBytes("my_value") );

Error:

System.InvalidOperationException: Either absolute or sliding expiration needs to be provided.
   at Pomelo.Extensions.Caching.MySql.DatabaseOperations.ValidateOptions(Nullable`1 slidingExpiration, Nullable`1 absoluteExpiration)
   at Pomelo.Extensions.Caching.MySql.DatabaseOperations.SetCacheItem(String key, Byte[] value, DistributedCacheEntryOptions options)
   at Pomelo.Extensions.Caching.MySql.MySqlCache.Set(String key, Byte[] value, DistributedCacheEntryOptions options)
   at Microsoft.Extensions.Caching.Distributed.DistributedCacheExtensions.Set(IDistributedCache cache, String key, Byte[] value)

Expectation: If DistributedCacheEntryOptions.SlidingExpiration is not specified, the Set should use the DefaultSlidingExpiration as set in the AddDistributedMySqlCache options.

Convert to netstandard 2.1

Given the dotnet core 3.1 is the new Long term supported framework (LTS) consider changing to netcoreapp3.1 and netstandard2.1 respectively for *.csproj

Strong name Pomelo.Extensions.Caching.MySql.dll

Can we please have Pomelo.Extensions.Caching.MySql.dll strong named?

This will fix the warning I am receiving when compiling a strong named project, referencing this package:

Warning CS8002 Referenced assembly 'Pomelo.Extensions.Caching.MySql, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null' does not have a strong name.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.