Julia: 读取 Memcached 的数据 (Read)

#! /usr/bin/julia
#
#   mcached_read.jl
#
#                   Dec/30/2021
# --------------------------------------------------------------------
using Memcache
using JSON
# --------------------------------------------------------------------
println(stderr,"*** 開始 ***")
#
mc = MemcacheClient("localhost", 11211)
#
set_keys = ["t1731","t1732","t1733","t1734","t1735","t1736","t1737",
    "t1738","t1739"]
#
for kk in set_keys
    try
        str_json = get(mc, kk)
#       println(typeof(str_json))
        if typeof(str_json) == String
            unit_aa = JSON.parse(str_json)
            print(kk, '\t', unit_aa["name"])
            print('\t',unit_aa["population"])
            println('\t',unit_aa["date_mod"])
        end
    catch
#       println("*** error ***")
    end
end
#
println(stderr,"*** 終了 ***")
# --------------------------------------------------------------------