Ejemplo n.º 1
0
    def test_delete_cache(self):
        cache_key = self.CACHE_KEY
        cache_value = self.CACHE_VALUE1

        # セットする
        GsocialCache.set_cache(cache_key, cache_value, timeout=5)
        # 取得する
        result = GsocialCache.get_cache(cache_key)
        eq_('test_value1', result)

        # 削除する
        GsocialCache.delete_cache(cache_key)
        # 取得する
        result = GsocialCache.get_cache(cache_key)
        eq_(None, result)
Ejemplo n.º 2
0
    def test_delete_cache(self):
        cache_key = self.CACHE_KEY
        cache_value = self.CACHE_VALUE1

        # セットする
        GsocialCache.set_cache(cache_key, cache_value, timeout=5)
        # 取得する
        result = GsocialCache.get_cache(cache_key)
        eq_('test_value1', result)

        # 削除する
        GsocialCache.delete_cache(cache_key)
        # 取得する
        result = GsocialCache.get_cache(cache_key)
        eq_(None, result)
Ejemplo n.º 3
0
    def put(self, userid, text_id, message):
        '''
        PUT(更新)
        POSTで得られたitemIdを用いることでテキストデータを更新することができる
        
        PUT(update)
        You can update the text data using the itemId you got from POST.
        '''
        # ローカルではリクエストできない
        # You can`t request on local.
        if settings.OPENSOCIAL_DEBUG:
            return None

        message = self.container.encode_emoji(message)
        data = simplejson.dumps({'data': message})
        response = self._api_request('PUT', userid, text_id = str(text_id), data = data)
        Log.debug('Inspection PUT. response: %s' % (response))
        # GET のために削除
        # Delete for GET
        GsocialCache.delete_cache(self._get_cache_key(text_id))
        return None
Ejemplo n.º 4
0
    def delete(self, userid, text_id):
        '''
        DELETE(削除)
        item_idはPOSTで得られたitemId
        
        DELETE
        item_id is the itemId you got from POST.
        '''
        # ローカルではリクエストできない
        # You can`t request on local. 
        if settings.OPENSOCIAL_DEBUG:
            return None

        response = self._api_request('DELETE', userid, text_id = text_id)
        Log.debug('Inspection DELETE. response: %s' % (response))
        # 削除
        # delete
        GsocialCache.delete_cache(self._get_cache_key(text_id))
        # test
        #cache =GsocialCache.get_cache(self._get_cache_key(text_id))
        #print 'delete cache', cache
        return None
Ejemplo n.º 5
0
    def _cache_clear(cls, user_id):
        """
        cache_clear
        """
        auth_model = '/opensocial/authdevice/model/%s' % user_id
        user_grade = '/opensocial/authdevice/api/user_grade/%s' % user_id
        auth_id = '/opensocial/authdevice/api/%s' % user_id

        GsocialCache.delete_cache(auth_model)
        GsocialCache.delete_cache(user_grade)
        GsocialCache.delete_cache(auth_id)