This file is indexed.

/usr/share/pyshared/gluon/contrib/gae_memcache.py is in python-gluon 1.99.7-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Developed by Robin Bhattacharyya (memecache for GAE)
Released under the web2py license (LGPL)

from gluon.contrib.gae_memcache import MemcacheClient
cache.ram=cache.disk=MemcacheClient(request)
"""

import time
from google.appengine.api.memcache import Client


class MemcacheClient(Client):

    def __init__(self, request):
        self.request = request
        Client.__init__(self)

    def __call__(
        self,
        key,
        f,
        time_expire=300,
        ):
        key = '%s/%s' % (self.request.application, key)
        dt = time_expire
        value = None
        obj = self.get(key)
        if obj and (dt == None or obj[0] > time.time() - dt):
            value = obj[1]
        elif f is None:
            if obj:
                self.delete(key)
        else:
            value = f()
            self.set(key, (time.time(), value))
        return value

    def increment(self, key, value=1):
        key = '%s/%s' % (self.request.application, key)
        obj = self.get(key)
        if obj:
            value = obj[1] + value
        self.set((time.time(), value))
        return value

    def clear(self, key):
        key = '%s/%s' % (self.request.application, key)
        self.delete(key)