• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 399
  • Last Modified:

PHP >> Memcache >> C#

Hi all,

I have a simple string that I am creating and placing in Memcache using PHP. Is as follows...

<?php
$memcache = new Memcache;
$memcache->connect("localhost",11211);
$memcache->set('mykey', "hello");
?>

Open in new window


I can then access the string using Telnet so I know it is in there. I do this by referencing the "mykey" identifier.

Then we come onto .NET. I am using Enyim as the widely used .api to gain access to the memcache.

So when I try to retrieve the "mykey" data stored in memcache I dont get anything back. So like this...

using (MemcachedClient writeClient = new MemcachedClient())
{
string[] myString = writeClient.Get<string[]>("mykey");
}
            {

Open in new window



I am wondering if it is to do with the dattype string from both lanuages. Any advise would be greatly appreciated with this.

Thank you.
0
meetsys
Asked:
meetsys
  • 2
  • 2
1 Solution
 
jayakrishnabhCommented:
Please try this once..

MemoryCache memoryCache = MemoryCache.Default;
            String mystring = Convert.ToString(memoryCache.Get("mykey", null));
0
 
meetsysAuthor Commented:
Hi,

I dont have a MemoryCache class to utilise so cannot use that.
0
 
jayakrishnabhCommented:
If using >=.net 4.0 , add System.Runtime.Caching dll to use that class
0
 
meetsysAuthor Commented:
.net 2.0/3.5 and cant be changed.
0
 
käµfm³d 👽Commented:
Why are you "getting" a string array (line 3)? Shouldn't this simply be a string?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now