liveBook · Manning

Dotnet-sql-cache package

As explained in Building Web APIs with ASP.NET Core

The sql-cache command is a .NET CLI command that creates the database schema required by the SQL Server distributed cache provider.

The dotnet-sql-cache package provides the .NET CLI command that creates the database table required by the SQL Server distributed cache provider. In the board-game API, it creates the dedicated AppCache table in the existing MyBGList database. section 8.4.2

Create the cache table from the project root:

  • Install the package with a version matching the installed .NET version, including its patch number. section 8.4.2
  • Run the create command with the DefaultConnection value, the dbo schema, and the AppCache table name. section 8.4.2
  • Use the complete connection string, including credentials, and replace doubled backslashes in SQL Server paths with single backslashes. section 8.4.2
  • Verify that the command creates AppCache, or create the table manually with SQL Server Management Studio instead. section 8.4.2
dotnet tool install --global dotnet-sql-cache -version 6.0.11

Install the CLI tool with the required version. section 8.4.2

dotnet sql-cache create "{connectionString}" dbo AppCache

Create the dbo.AppCache table by supplying the connection string and database identifiers. section 8.4.2

Generated cache table

A successful command creates dbo.AppCache with required Id, Value, ExpiresAtTime, SlidingExpirationInSeconds, and AbsoluteExpiration columns for distributed cache entries. section 8.4.2

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Covers installation, command arguments, version matching, connection-string escaping, generated columns, and an SSMS alternative.
Examples
Uses dbo.AppCache and demonstrates installing dotnet-sql-cache before running sql-cache create.
What it assumes
Assumes an installed .NET version, a SQL Server database, and a complete connection string with credentials.
What you can do after
Operate/configure SQL Server distributed caching by installing the CLI tool and generating its required database table.
How it connects
Links the .NET CLI command to SQL Server, distributed caching, connection strings, and the AppCache table.

Also explained in

Compare how 2 books explain dotnet-sql-cache package →

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.