Giter Site home page Giter Site logo

haneytron / dache Goto Github PK

View Code? Open in Web Editor NEW
139.0 30.0 39.0 7 MB

Dache is a highly scalable, efficient, well-performing distributed caching system developed for and in the .NET framework.

Home Page: http://www.dache.io

License: Other

C# 90.11% ASP 0.03% CSS 0.88% JavaScript 8.01% Pascal 0.43% Batchfile 0.56%

dache's Introduction

DACHE

Distributed caching for .NET applications

Fast, scalable distributed caching with meaningful performance metrics for your managers and a simple API for your development team

WEB: http://www.dache.io

EMAIL: [email protected]

NUGET: Dache.Client and Dache.CacheHost

DOWNLOAD: http://www.dache.io/download

WIKI: http://www.github.com/ironyx/dache/wiki

VERSION INFORMATION

1.6.1

  • Client: Minor performance improvements
  • Cache Host: Minor performance improvements
  • Performance Tests: Updated Infinite Add test to insert 1ms sleep every 1000 adds (helps with infinite loop CPU contention that was sometimes overloading outgoing Socket send buffer)
  • Performance Tests: Changed all tests to use ProtoBuf-Net serializer. It's faster and better than BinarySerializer, and a much better demonstration of the speed and performance of Dache
  • Upgraded SimplSockets to 1.4.7 which provides performance and memory optimizations at the TCP socket level

INSTALLATION INSTRUCTIONS

Getting started quickly involves standing up the Dache Client and a Dache Host for the client to communicate with.

Client

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:

NuGet Client

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.

Manual DLL Reference

To install and 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.

Client Notes And Next Steps

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 wiki.

Host

The host is the actual process that does the caching work. You have 3 options for hosting Dache:

Quick And Easy Console Host

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.

Windows Service

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.

Host In Your Own Process

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);

Host Notes And Next Steps

To learn more about using Dache, check out the wiki.

LICENSE INFORMATION

Dache software is dual licensed. You must choose which license you would like to use Dache under from the following 2 options:

The GNU General Public License Version 3 available for review at http://www.gnu.org/copyleft/gpl.html

-or-

The Commercial Dache License, which must be purchased directly from Imperative Bytes, LLC - the Limited Liability Company which owns the Dache source code. You may purchase the Commercial Dache License by contacting us at [email protected].

Please see LICENSE.txt for more information.

IMPORTANT NOTE TO SOURCE CODE CONTRIBUTORS

In order to clarify the intellectual property license granted with Contributions from any person or entity, Imperative Bytes, LLC. ("Imperative Bytes") must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms of the Dache Individual Contributor License Agreement (located in INDIVIDUAL.txt). This license is for your protection as a Contributor as well as the protection of Imperative Bytes; it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete, scan, and e-mail an original signed Agreement to [email protected].

dache's People

Contributors

aweber1 avatar haneytron avatar ingmmajcica avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dache's Issues

Lower the getting started curve for Dache

Right now you have to download the source for Dache and compile it in order to get a runnable installer, and it's not obvious that the file named install.bat in the root directory is not the one you should run but instead the one that gets copied to the output directory. A simple, download this and run it tool that installs the service would be much easier.

When you include nuget package, it adds a file named Client.Example.Config that contains a bunch of config options for the package, most of which are not needed to get you started. When you install the nuget package, it would be much better if it added the minimal required setup directly to the actual Web.Config in order to work with an unmodified install of the windows service host. The name of the example file is also uninformative and I actually thought it was added by mvc or asp.net and not Dache. Instead of including that file, just have VS open the webpage (that you will eventually add) showing which advanced options are available and how to integrate them.

If these changes were made, just trying out the tool would be much easier because no one cares about advanced settings on the first use. Then you can focus the rest of your guide on extending the minimal setup instead of introducing them to all the features before they ever get it running.

For reference, the quick start process.

There are no reachable cache hosts available. Verify your client settings and ensure that all cache hosts can be successfully communicated with from this client

After updating to last version I receive the following exception from clients:

There are no reachable cache hosts available. Verify your client settings and ensure that all cache hosts can be successfully communicated with from this client

Client config:

<configSections>
    <section name="cacheClientSettings" type="Dache.Client.Configuration.CacheClientConfigurationSection, Dache.Client" />          
    </sectionGroup>
    <section name="resizer" type="ImageResizer.ResizerSection" requirePermission="false" />
  </configSections>
  <cacheClientSettings hostReconnectIntervalSeconds="10" hostRedundancyLayers="0">
    <cacheHosts>
      <add address="localhost" port="33333" />
    </cacheHosts>
  </cacheClientSettings>

I've hosted the dache host on windows service, with the following config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="cacheHostSettings" type="Dache.CacheHost.Configuration.CacheHostConfigurationSection, Dache.CacheHost" allowExeDefinition="MachineToApplication" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <cacheHostSettings maximumConnections="40" cacheMemoryLimitPercentage="85" port="33333" />
</configuration>

It worked well, but after updating the error has occurred !

I'm dead sure the windows service (dache host) is running.

Is it possible to access caches values in dache CacheHost ?

Assume we have a dache's CacheHost on Windows Service.
I wanna do some processes within CacheHost and sending the result (an entity) to the client. (for best performance and minimum data on service channel )

e.g:
Each entity is saved separately in dache cache, like "Device1", "Device2", "Device2", ... (these were cache keys)
I have a method to search a name into all device's entities, so I have to get all caches and check it's name. Now, I'm gonna send a name to dache cache host and get the entity result.

So, my question is:
Is it possible to access cached values in dache cache host?

Sorry, I didn't know where should I post my question!

Broken test out of the box

Just cloned repo, DacheMvcChildActionCache_Add_GivenValidInput_ShouldNotThrowException is broken on my machine.

Test method Dache.Tests.Dache.Client.DacheMvcChildActionCacheTests.DacheMvcChildActionCache_Add_GivenValidInput_ShouldNotThrowException threw exception: 
System.ArgumentOutOfRangeException: The UTC time represented when the offset is applied must be between year 0 and 10,000.
Parameter name: offset
    at System.DateTimeOffset.ValidateDate(DateTime dateTime, TimeSpan offset)
   at System.DateTimeOffset..ctor(DateTime dateTime)
   at System.DateTimeOffset.op_Implicit(DateTime dateTime)
   at Dache.Client.Plugins.OutputCache.DacheMvcChildActionCache.Add(String key, Object value, DateTimeOffset absoluteExpiration, String regionName) in DacheMvcChildActionCache.cs: line 55
   at Dache.Tests.Dache.Client.DacheMvcChildActionCacheTests.DacheMvcChildActionCache_Add_GivenValidInput_ShouldNotThrowException() in DacheMvcChildActionCacheTests.cs: line 103

Create nuget package for Dache Client.

It will be nice to be able to add the client in your projects via nuget. I will not list all the benefits of having it added as a package instead of referencing only a lib.

The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly

When I wanna start Windows service Dache Host the following exception at OnStart method occurred :

// Exception : "The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly"
PerformanceCounterPerformanceDataManager performanceDataManager = new PerformanceCounterPerformanceDataManager(port);

I tested it on Windows 8.1, with VS 2013 and .Net 4.5

How to resolve it ?

Install service host fails silently when not run as administrator

The install script that is included runs the installer in a new console window which disappears quickly when the install fails with no indication of failure until you look for the installed service. I was able to check the logs to find the problem, but only after trying to run it again and noticing the log file name gets printed at the beginning of the install script.

'Dache.Client.Exceptions.NoCacheHostsAvailableException' occurred in Dache.Client.dll

I have a dache windows service with the following config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="cacheHostSettings" type="Dache.CacheHost.Configuration.CacheHostConfigurationSection, Dache.CacheHost" allowExeDefinition="MachineToApplication" />
  </configSections>
  <cacheHostSettings port="33333" />
</configuration>

It's OK and started without any problems.
Also, I have 3 dache clients with the following configs:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="cacheClientSettings" type="Dache.Client.Configuration.CacheClientConfigurationSection, Dache.Client" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <cacheClientSettings>
    <cacheHosts>
      <add address="localhost" port="33333" />
    </cacheHosts>
  </cacheClientSettings>
</configuration>

It's OK if I just have one client. But when I'm using 3 clients, the clients in the following line stuck and nothing happen:

static void Main(string[] args)
{
    Console.WriteLine("Start");

    CacheProvider cacheProvider = new CacheProvider();
    cacheProvider.ClearCache(); // stuck in this line
    cacheProvider.AddOrUpdate("SomeKey", "Hello Mohammad");

    Console.WriteLine("Cache added");
    Console.ReadKey();
}

I check windows log, the following exception has occurred

An unhandled exception of type 'Dache.Client.Exceptions.NoCacheHostsAvailableException' occurred in Dache.Client.dll

Additional information: There are no reachable cache hosts available. Verify your client settings and ensure that all cache hosts can be successfully communicated with from this client.

What's wrong?

Implement StyleCop in process

StyleCop will be adequate in order to maintain the coding style uniform, as more developers are joining in the project.
A set of default rules should be proposed, and later modified if any objections. Once defined, StyleCop warnings should be treated as errors.

after restarting service all webapp are unable to reconnect

after restarting the service the log file says that reconnect was successful

03/13/2015 1:17:46 AM
Cache Host Reconnected
The cache client has successfully reconnected to the cache host located at 127.0.0.1:33333

but any cache operation results in the following exception

There are no reachable cache hosts available. Verify your client settings and ensure that all cache hosts can be successfully communicated with from this client.

No other messages from dache logger
Only w3wp restart resolves that issue.

Start Dache Host on Demand

Do Dache have any functionality to start the host on demand and join the existing cluster automatically by pulling the already available cache on already running host to the new host automatically.
For Eg:

I have host1 running with 1 gb cache data in it and there after if I start host2 then, will host2 automatically replicate all the available data on host1 to host2?.

We can call this as some kind of clustering topology.

Mentioned functionality will help in much more high availability of data.This will help in maintenance on live production environment with no data loss and highly available all time even if maintenance is running on other side

Web App disconnected after some hours?

I'm developing a Web App with Dache, Thanks the author for the fantastic library.
Unfortunately, I have a big problem with it.
In previous version of 1.5.6, it was worse. but in 1.5.6 it's better but still I get The following message:
There are no reachable cache hosts available. Verify your client settings and ensure that all cache hosts can be successfully communicated with from this client.
In developing, I get the exception after 2 or 3 times build, and I have to restart cache service and rebuild the application to remove the exception.
In web app after some hours the clients disconnect from cache service. and I have to restart the cache service and web sites to remove the exception.
Could you please guide me, How I can remove this exception?

P.S:
I hosted dache on windows service.

Thanks in advanced

Implement ILMerge in Build Process for Client

I'd like the client to be a single DLL, Dache.Client.dll, so implementing ILMerge in the Client project's build process to merge Client, Core, and SimplSockets to a single DLL would be awesome.

Infinite loop in GetCacheKeys

Hi there,

I believe there is a chance for an infinite loop in the GetCacheKeys and GetCacheKeysTagged methods.

image

If there are no items in the cache, the "rawResults" variable will be null and the foreach statement will raise a NullReferenceException, which will cause a never ending do...while loop.

Easily fixable, though.

Keep up the good work!

Rudy

Can't connect from remote client

Hi,

I'm evaluating Dache for a project I'm working on, and I've run into a problem.

I'm trying to test connectivity to a Dache windows service from a remote machine (on same subnet) but I can't connect.
All firewalls are turned off, both machines are running Windows 7.

When I query the port from the remote machine, it comes back as 'NOT LISTENING', however it works as expected when queried from the localhost.

I can query other ports from that remote machine with no problems. e.g. port 80 returns as LISTENING correctly.

Is there anything in SimplSocket which would cause it to only listen to connections from localhost?

Apart from this problem, I've enjoyed looking through and playing with your library.

Great work!

Cheers,

Adrian

Local cache

Do you have option for storing cache locally (in memory) as well as out of process? This way the cache will check for RAM and only go out of process when it does not exist.

Dache cache host, stuck at most of the times ?

I'm working with latest version 1.5.5 of dache.net
I hosted it on Windows Services with the following config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
        <section name="cacheHostSettings" type="Dache.CacheHost.Configuration.CacheHostConfigurationSection, Dache.CacheHost" allowExeDefinition="MachineToApplication" />
    </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <cacheHostSettings maximumConnections="40" cacheMemoryLimitPercentage="85" maximumMessageSizeKB="2097151" port="33333" />
</configuration>

In clients I have the following config:

    .
    .
    .
    <section name="cacheClientSettings" type="Dache.Client.Configuration.CacheClientConfigurationSection, Dache.Client" />
    .
    .
    .
  </configSections>
  <cacheClientSettings hostReconnectIntervalSeconds="10" hostRedundancyLayers="0" maximumMessageSizeKB="2097151">
    <cacheHosts>
      <add address="localhost" port="33333" />
    </cacheHosts>
  </cacheClientSettings>

It's OK at first and Clients can connect to host without any problems.
But after some(1,2) minutes cache host stuck and begin to throw the following exception (from log file):

2015-01-25T11:44:14 WARN Dache Client Disconnected : System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host
   at SimplSockets.SimplSocketServer.ReceiveCallback(IAsyncResult asyncResult) in d:\SimplSockets\SimplSockets\SimplSocketServer.cs:line 473
2015-01-25T11:45:31 WARN Dache Client Disconnected : System.Net.Sockets.SocketException (0x80004005): An existing connection was forcibly closed by the remote host
   at SimplSockets.SimplSocketServer.ReceiveCallback(IAsyncResult asyncResult) in d:\SimplSockets\SimplSockets\SimplSocketServer.cs:line 473
...

Above exception happens more in debug mode.
What's wrong?

StackTrace of clietns:

[NoCacheHostsAvailableException: There are no reachable cache hosts available. Verify your client settings and ensure that all cache hosts can be successfully communicated with from this client.]
   Dache.Client.CacheClient.DetermineBucket(String cacheKey) in d:\Dache\Dache.Client\CacheClient.cs:947
   Dache.Client.CacheClient.TryGet(String cacheKey, T& value) in d:\Dache\Dache.Client\CacheClient.cs:137
   Smartiz.CacheClient.CacheProvider.TryGet(String key, T& value) in d:\Works\Smartiz\Smartiz.CacheClient\CacheProvider.cs:34
   Smartiz.CacheClient.CachedParams.get_AllAttachmentsTypes() in d:\Works\Smartiz\Smartiz.CacheClient\CacheTools\CachedParams.cs:36
   Smartiz.CacheClient.MappingsProfile.Configure() in d:\Works\Smartiz\Smartiz.CacheClient\Mapper\MappingsProfile.cs:127
   AutoMapper.ConfigurationStore.AddProfile() +56
   Smartiz.CacheClient.AutoMapperConfiguration.b__0(IConfiguration x) in d:\Works\Smartiz\Smartiz.CacheClient\Mapper\AutoMapperConfiguration.cs:7
   AutoMapper.Mapper.Initialize(Action`1 action) +41
   Smartiz.CacheClient.AutoMapperConfiguration.Configure() in d:\Works\Smartiz\Smartiz.CacheClient\Mapper\AutoMapperConfiguration.cs:7
   Smartiz.Admin.MvcApplication.Application_Start() in d:\Works\Smartiz\Smartiz.Admin\Global.asax.cs:54

[HttpException (0x80004005): There are no reachable cache hosts available. Verify your client settings and ensure that all cache hosts can be successfully communicated with from this client.]
   System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9916673
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): There are no reachable cache hosts available. Verify your client settings and ensure that all cache hosts can be successfully communicated with from this client.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9930568
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

Infinite loop in CacheClient constructor

Scenario:

  1. Define several connection hosts in app.config for CacheClient app
  2. Try instantiate the CacheClient class with not running CacheServer
  3. Infinite loop happens here
// Now connect to each cache host
for (int i = 0; i < _cacheHostLoadBalancingDistribution.Count; i++)
{
    var cacheHostBucket = _cacheHostLoadBalancingDistribution[i];
    if (!cacheHostBucket.CacheHost.Connect())
    {
        i--;
    }
}

BTW infinite loop also happens in case of several cache servers are defined in app.config and only one of them is not running.

Server force disconnect

I have 2 questions that;

  1. Why the cache host will always disconnect after a client first time connection. It should be base on the "communicationTimeoutSeconds" setting in the app.config.
  2. If there is only 1 cache host server, after disconnecting, there comes out an error when call the method "cacheHostBucket.GetNext()" in event "OnClientDisconnected". It seems caused by the host list is empty~

Performance Counter Memory Leak

Received email:

hi David,

I found another bug within Dache host. It crashed with following
exception recorded within Event viewer:

Application: Dache.CacheHost.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.OutOfMemoryException
Stack:
at Microsoft.Win32.RegistryKey.InternalGetValue(System.String,
System.Object, Boolean, Boolean)
at Microsoft.Win32.RegistryKey.GetValue(System.String)
at System.Diagnostics.PerformanceMonitor.GetData(System.String)
at System.Diagnostics.PerformanceCounterLib.GetPerformanceData(System.String)
at System.Diagnostics.PerformanceCounterLib.GetCategorySample(System.String,
System.String)
at System.Diagnostics.PerformanceCounter.NextSample()
at System.Diagnostics.PerformanceCounter.get_RawValue()
at Dache.CacheHost.Polling.CacheHostInformationPoller.PollCacheHost(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext,
System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext,
System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()

I just wrapped your code in CacheHostInformationPoller.PollCacheHost
method with try/catch block. Proper solution would be to stop timer
executing for a while ... or something ;)

Add SimplSockets as nuget package

Remove duplicated and linked code referring to SimplSockets. A more elegant solution, as SimplSockets is a separate project will be adding SimplSockets as a NuGet package.

TryGet stuck ! 1.4.9

Hello again,
I have a dache host Windows Service with the following config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
        <section name="cacheHostSettings" type="Dache.CacheHost.Configuration.CacheHostConfigurationSection, Dache.CacheHost" allowExeDefinition="MachineToApplication" />
    </configSections>
    <cacheHostSettings port="33333" />
</configuration>

Dache windows service start without any problem.

I have some another clients with the following configs:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="cacheClientSettings" type="Dache.Client.Configuration.CacheClientConfigurationSection, Dache.Client" />
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
  </startup>
  <cacheClientSettings>
    <cacheHosts>
      <add address="localhost" port="33333" />
    </cacheHosts>
  </cacheClientSettings>
</configuration>

I wanna get a cache from second clients as the follows:

static void Main(string[] args)
{
    CacheProvider cacheProvider = new CacheProvider();

    Console.WriteLine("Start");

    string output;
    cacheProvider.TryGet("SomeKey", out output);// stuck
    Console.WriteLine(output);

    Console.ReadKey();
}

But above code stuck at TryGet without any responses.
I've checked windows log(event viewer), it doesn't show any errors !!!

Incorrect Cache Key!

In GetTaggedLocal method you are trying to retrieve data from local cache using tagname but you are dumping this data into local cache using cache key. I believe every call to this method will bring the data from Dache service instead of local cache.
Plz see the screen shot for reference.

untitled

Freezes of CacheClient in case CacheServer process is stopped

Here is the scenario:

  1. start cache server
  2. start cache client
  3. assign some value to some key using the cacheclient
  4. stop cache server
  5. try get value from cache client using key from step 4 ( value is
    returned! )
  6. try get value from cache client using key from step 4 again (freeze
    happens!)

Infinite freeze happens here:

// Wait for our message to go ahead from the receive callback
multiplexerData.ManualResetEvent.WaitOne();

This can be fixed by the following change

multiplexerData.ManualResetEvent.WaitOne(500);

But it still will lead to more problems in next iterations of sockets data checking.

i.e. use-case when we are using several cache servers and some of them are stopped is not workable for a cache client.

Default logger in CustomTypesLoader

When not defining your own logger CustomTypesLoader defaults to EventViewerLogger. This is causing security exception when the running user account do not have permission to create the new EventSource. My suggestion is default to a TraceEventLogger.

Install-Package : Failed to add reference to 'System.Configuration'. Please make sure that it is in the Global Assembly Cache.

When I wanna install dache client package I'm getting the following error:

PM> Install-Package Dache.Client
Attempting to resolve dependency 'SimplSockets (= 1.3.5)'.
Attempting to resolve dependency 'SharpMemoryCache (= 1.0.0)'.
Installing 'Dache.Client 1.4.8'.
You are downloading Dache.Client from David Haney, the license agreement to which is available at https://github.com/ironyx/dache/blob/master/LICENSE.txt. Check the package for additional dependencies, which may come with their own license agreement(s). Your use of the package and dependencies constitutes your acceptance of their license agreements. If you do not accept the license agreement(s), then delete the relevant components from your device.
Successfully installed 'Dache.Client 1.4.8'.
Adding 'SimplSockets 1.3.5' to ConsoleApplication.
Successfully added 'SimplSockets 1.3.5' to ConsoleApplication.
Adding 'SharpMemoryCache 1.0.0' to ConsoleApplication.
Successfully added 'SharpMemoryCache 1.0.0' to ConsoleApplication.
Adding 'Dache.Client 1.4.8' to ConsoleApplication.
Uninstalling 'Dache.Client 1.4.8'.
Successfully uninstalled 'Dache.Client 1.4.8'.
Install failed. Rolling back...
Install-Package : Failed to add reference to 'System.Configuration'. Please make sure that it is in the Global Assembly Cache.
At line:1 char:1
+ Install-Package Dache.Client
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], InvalidOperationException
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
 

What's wrong with it ?

Client.Example.Config is a terrible name

When you install the nuget package in your asp.net app, it adds a Client.Example.Config to the project. I honestly thought this came from asp.net or MVC or something and did not think it came from Dache at all. Putting the name of the project in the example file name would be better.

A few questions

I couldn't find this in the wiki:

  • Does Dache support expirting cache on it's own? Like an absolute expiration?
  • Does it keep a local copy of the cache and sync w/ the server, or does it all come from the host?
  • If the host is unreachable, will it work locally? Trying to reduce failure points

Thanks.

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.