0

Hello fellow Stackoverflowians.

I'm looking to extract information from a cache key from a Kyoto Tycoon cabinet file, specifically from the output from the Kyoto Cabinet utility kchashmgr (see: http://fallabs.com/kyotocabinet/util.html#kchashmgr )

I am trying to extract the expiration date from the output of the kchashmgr get from the binary/hexadecimal output.

kchashmgr get /path/to/kyto/tycoon/casket.kch cache_key

What is the output format of the above so from command-line shell utility I can do this:

expirationTimestamp=$(kchashmgr get /path/to/kyto/tycoon/casket.kch cache_key | something)

Initially I thought I could gunzip it (required ZLIB for it installation), but that obviously did not work. I also tried using the -px switch to see if that helped.

NOTE: I am looking for a shell solution that would, presumably, be faster than using a PHP script.

Thanks for your time on this subject.

P.S.

[yramirez@losthost ~ ]$ kcutilmgr conf -v  # version of Kyoto Cabinet
1.2.76
Yzmir Ramirez
  • 1,281
  • 7
  • 11
  • 1
    Kyoto is just a key/value store. The value you get back when you give it a key is the opaque "value" for that key. If that value has any structure or format, it is determined by the application that wrote it and is not modified in any real way by Kyoto. Where did the data in the db come from? – Joe Jun 25 '14 at 00:41
  • @Joe the data was stored using Memcached interface with a Kyoto Tycoon backend and the MEMCACHE_COMPRESSED flag turned on. BTW, I already have a solution using a PHP script that takes a command-line argument as the key, but it is slow for obvious reasons. I was considering writing my own Kyoto Cabinet extension, but that is over kill. – Yzmir Ramirez Jun 25 '14 at 15:36
  • 1
    Parsing the result from that command means knowing how memcached is formatting/compressing that input. – Joe Jun 25 '14 at 18:03
  • The output is partially compressed, but is in some kind of data struct. I was going to go into the source and see how it is echoed to the console, but I haven't written in C++ in 8 years :-( – Yzmir Ramirez Jun 26 '14 at 17:16

0 Answers0