Solved

PHP >> Memcache >> C#

Posted on 2014-03-24
5
354 Views
Last Modified: 2014-03-24
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
Comment
Question by:meetsys
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Expert Comment

by:jayakrishnabh
ID: 39950054
Please try this once..

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

Author Comment

by:meetsys
ID: 39950077
Hi,

I dont have a MemoryCache class to utilise so cannot use that.
0
 
LVL 5

Expert Comment

by:jayakrishnabh
ID: 39950108
If using >=.net 4.0 , add System.Runtime.Caching dll to use that class
0
 

Author Comment

by:meetsys
ID: 39950115
.net 2.0/3.5 and cant be changed.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39950487
Why are you "getting" a string array (line 3)? Shouldn't this simply be a string?
0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question