Click here to Skip to main content
15,902,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI,

I having an input file(.JSON,.jpg,.txt,etc..).That file i need to store into memcached server.
I don't want to convert file to byte[] before passing to memcached server.
If any possibility to store file inside Memcached server?
I am using spymemcached tool.


Example:

Java
MemcachedClient mc=new MemcachedClient(new InetSocketAddress("192.168.7.104",11211));	
File file=new File("D:\\test.txt");
mc.set("Key1",3600,file);
mc.get("Key1");


Plz replay if any sollution..
Thanks in Advance..
Sekhar.
Posted
Updated 17-Oct-13 4:55am
v2

1 solution

You can get the bytes for a file simply with :
C#
byte[] b = File.ReadAllBytes("filename.ext");

If your content is an in-memory string you can do the following:
C#
byte[] b = Encoding.Unicode.GetBytes("string value here");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900