Solved

PHP >> Memcache >> C#

Posted on 2014-03-24
5
351 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Building an object from several other objects 4 34
Java ArrayList and if statement 2 50
How does this modal gets closed? 6 38
Position image fpdf 4 11
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

738 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