This file is indexed.

/usr/share/pyshared/TileCache/Caches/Memcached.py is in tilecache 2.11-2.

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
# BSD Licensed, Copyright (c) 2006-2010 TileCache Contributors

from TileCache.Cache import Cache
import time

class Memcached(Cache):
    def __init__ (self, servers = ['127.0.0.1:11211'], **kwargs):
        Cache.__init__(self, **kwargs)
        import memcache
        if type(servers) is str: servers = map(str.strip, servers.split(","))
        self.cache = memcache.Client(servers, debug=0)
   
    def getKey(self, tile):
         return "/".join(map(str, [tile.layer.name, tile.x, tile.y, tile.z]))
        
    def get(self, tile):
        key = self.getKey(tile)
        tile.data = self.cache.get(key)
        return tile.data
    
    def set(self, tile, data):
        if self.readonly: return data
        key = self.getKey(tile)
        self.cache.set(key, data)
        return data
    
    def delete(self, tile):
        key = self.getKey(tile)
        self.cache.delete(key)

    def attemptLock (self, tile):
        return self.cache.add( self.getLockName(tile), "0", 
                               time.time() + self.timeout)
    
    def unlock (self, tile):
        self.cache.delete( self.getLockName(tile) )