>>>

On Wed, Mar 18, 2009 at 6:22 PM, Dustin <[email protected]> wrote:

>
>
> On Mar 18, 6:12 pm, Baskaran <[email protected]> wrote:
>
> > As I understand the -M option is going to ensure that all the values
> > that I store in memcached will be retained, unless I delete them
> > explicitly.
>
>  -M means objects won't be prematurely removed from memcache -- I'm
> not completely sure how safe it is for general operation.
>
>  If your goal is to build a permanent memory storage, you're
> deviating from general use.
>
> > As you can see, more than half the entries are missing and I can't
> > figure out why? Has someone got some idea?
>
>   It'd be more useful to see what your client actually does.  Can you
> post a simple test?


>>> Ok, I have stored all the keys in a separate file, when they were added
to memcached and my python script now reads the keys and get the values. The
relevant snippet is below:

def xtract_rCounts(rcountFile, falignFile, ralignFile):
    '''Extracts the rule counts for the key and write in a file'''

    key_misses1 = 0
    key_misses2 = 0
    key_misses3 = 0
    rC = open(rcountFile, 'w')
    fA = open(falignFile, 'w')
    rA = open(ralignFile, 'w')
    for src in keyDoD.keys():
        src_key = src.replace(' ', '-%-')
        for tgt in keyDoD[src].keys():
            tgt_key = tgt.replace(' ', '-%-')
            mc_key = src_key + '|||' + tgt_key
            mc_keyF = mc_key + '|||F'
            mc_keyR = mc_key + '|||R'

            r_count = mc.get(mc_key)
            if r_count is None:
                key_misses1 += 1
                print len(mc_key), mc_key
            else: rC.write( "%s ||| %s ||| %s\n" % (src, tgt, r_count) )

            f_align = mc.get(mc_keyF)
            if f_align is None:
                key_misses2 += 1
                print len(mc_keyF), mc_keyF
            else: fA.write( "%s ||| %s ||| %s\n" % (src, tgt, f_align) )

            r_align = mc.get(mc_keyR)
            if r_align is None:
                key_misses3 += 1
                print len(mc_keyR), mc_keyR
            else: rA.write( "%s ||| %s ||| %s\n" % (src, tgt, r_align) )

    rC.close()
    fA.close()
    rA.close()
    print( "Total # of key misses for rule count : %d" % (key_misses1) )
    print( "Total # of key misses for fwrd align : %d" % (key_misses2) )
    print( "Total # of key misses for rvrs align : %d" % (key_misses3) )

- B

Reply via email to