Contact: fumanchu@aminus.org

Log in as guest/dejavu to create tickets

Changeset 573

Show
Ignore:
Timestamp:
11/05/07 09:41:05
Author:
fumanchu
Message:

Crazycache: promoted IndexSet?.indices.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/crazycache/dejavu/storage/storememcached.py

    r572 r573  
    541541        self.cls = cls 
    542542        self._key_template = '%s:%s:index(%%s)' % (store.name, cls.__name__) 
    543         self._indices = [] 
     543        self.indices = [] 
    544544     
    545545    def add_index(self, *attributes): 
    546546        """Add an index over the given attributes.""" 
    547547        # Sort them from most-specific (most properties) to least. 
    548         if attributes not in self._indices: 
    549             self._indices.append(attributes) 
    550             self._indices.sort(lambda x, y: cmp(len(y), len(x))) 
     548        if attributes not in self.indices: 
     549            self.indices.append(attributes) 
     550            self.indices.sort(lambda x, y: cmp(len(y), len(x))) 
    551551     
    552552    def __iter__(self): 
    553         return iter(self._indices) 
     553        return iter(self.indices) 
    554554     
    555555    def key(self, filters): 
     
    693693        ident = tuple([getattr(unit, name) 
    694694                       for name in self.store.primary_keys[self.cls]]) 
    695         for index in self._indices: 
     695        for index in self.indices: 
    696696            indexcriteria = dict([(k, getattr(unit, k)) for k in index]) 
    697697            indexnode = self.get(indexcriteria) or [] 
     
    704704        ident = tuple([getattr(unit, name) 
    705705                       for name in self.store.primary_keys[self.cls]]) 
    706         for index in self._indices: 
     706        for index in self.indices: 
    707707            indexcriteria = dict([(k, getattr(unit, k)) for k in index]) 
    708708            indexnode = self.get(indexcriteria) or []