Quick Start
Getting started quickly involves standing up the Dache Client and a Dache Host for the client to communicate with.
The Dache Client is a single DLL which you reference in any application which you would like to use Dache with. You have 2 options for installing the Dache Client:
- Install the Dache.Client NuGet package
- Reference
Dache.Client.dll
manually from the latest release download
Install the Dache Client via NuGet. Your web.config
or app.config
will be automatically modified to include the default Dache client configuration:
<configuration>
<configSections>
<section name="cacheClientSettings"
type="Dache.Client.Configuration.CacheClientConfigurationSection, Dache.Client"/>
</configSections>
<cacheClientSettings>
<cacheHosts>
<add address="localhost" port="33333" />
</cacheHosts>
</cacheClientSettings>
</configuration>
Next, instantiate the CacheClient
:
// Using the settings from app.config or web.config
var cacheClient = new Dache.Client.CacheClient();
or
// Using programmatically created settings
var settings = new CacheClientConfigurationSettings { ... };
var cacheClient = new Dache.Client.CacheClient(settings);
A file called CacheProvider.cs
will also be installed at the root of your project. It is a working example of using the CacheClient
and is intended for experimentation and getting a quick-start with Dache. You can build on top of this implementation or discard it completely. The purpose of it is to show you how to use the Dache client in your code.
To install the Dache Client manually, first download the binaries from http://www.dache.io/download and then copy the files located in the Client
folder to your solution's folder structure. Then, add a reference to Dache.Client.dll
to your project.
Next, instantiate the CacheClient
as demonstrated above. You'll also need to include the configuration above in your app.config
or web.config
file.
CacheClient
is intended to be used as a singleton. Do not create a new CacheClient
per request.
IMPORTANT: all clients should be configured with the same list of servers. The list of servers does not have to be in the same order, but each client's list should contain the same servers.
To learn more about using Dache, check out the other pages of this wiki.
The host is the actual process that does the caching work. You have 3 options for hosting Dache:
- Run the quick and easy console host provided in the latest release download
- Install the Windows service provided in the latest release download
- Host Dache in your own process by installing the Dache.CacheHost NuGet package
To use the console host, first download the latest release and then run (or double click) CacheHost/Dache.CacheHost.exe
. A console will open that verifies the Dache settings and then gives you information about Dache as it is used.
To install and use the provided Windows service, first download the binaries from http://www.dache.io/download and then run CacheHost/install.bat
. You will be offered custom installation settings, including the ability to rename the service if you want to install multiple Dache hosts on a single server under unique names.
After successful installation, you can run the service from Windows Services.
To uninstall Dache, run CacheHost/uninstall.bat
.
To host Dache in your own process, install the Dache Host via NuGet. Your web.config
or app.config
will be automatically modified to include the default Dache host configuration:
<configuration>
<configSections>
<section name="cacheHostSettings"
type="Dache.CacheHost.Configuration.CacheHostConfigurationSection, Dache.CacheHost"
allowExeDefinition="MachineToApplication" />
</configSections>
<cacheHostSettings port="33333" />
</configuration>
Next, instantiate the CacheHostEngine
:
// Using the settings from app.config or web.config
var cacheHost = new Dache.CacheHost.CacheHostEngine();
or
// Using programmatically created settings
var settings = new CacheHostConfigurationSettings { ... };
var cacheHost = new Dache.CacheHost.CacheHostEngine(settings);
To learn more about using Dache, check out the other pages of this wiki.