Show
Ignore:
Timestamp:
10/01/08 04:26:27 (3 months ago)
Author:
sabel
Message:

clean-up

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • events/phpframework/sabel/trunk/app/aspects/UserCache.php

    r20329 r20334  
    2727     
    2828    $cache = UserCache::getInstance(); 
    29     if ($data = $cache->read($userId)) { 
    30       if ($fp = $cache->lock($userId)) { 
    31         $data["statuses"]++; 
    32         $data["comment"] = $comment; 
    33         $cache->write($fp, $data); 
    34       } 
     29    list ($fp, $data) = $cache->lock($userId); 
     30     
     31    if ($data) { 
     32      $data["statuses"]++; 
     33      $data["comment"] = $comment; 
     34      $cache->write($fp, $data); 
    3535    } 
    3636  } 
     
    4141     
    4242    $cache = UserCache::getInstance(); 
    43     if ($data = $cache->read($userId)) { 
    44       if ($fp = $cache->lock($userId)) { 
    45         $data["statuses"]--; 
    46         $data["comment"] = Status::getLatestCommentByUserId($userId); 
    47         $cache->write($fp, $data); 
    48       } 
     43    list ($fp, $data) = $cache->lock($userId); 
     44     
     45    if ($data) { 
     46      $data["statuses"]--; 
     47      $data["comment"] = Status::getLatestCommentByUserId($userId); 
     48      $cache->write($fp, $data); 
    4949    } 
    5050  } 
     
    5555     
    5656    $cache = UserCache::getInstance(); 
     57    list ($fp, $data) = $cache->lock($userId); 
    5758     
    58     if ($data = $cache->read($userId)) { 
    59       if ($fp = $cache->lock($userId)) { 
    60         $data["friends"]++; 
    61         $cache->write($fp, $data); 
    62       } 
     59    if ($data) { 
     60      $data["friends"]++; 
     61      $cache->write($fp, $data); 
    6362    } 
    6463     
    65     if ($data = $cache->read($targetId)) { 
    66       if ($fp = $cache->lock($targetId)) { 
    67         $data["followers"]++; 
    68         $cache->write($fp, $data); 
    69       } 
     64    list ($fp, $data) = $cache->lock($targetId); 
     65     
     66    if ($data) { 
     67      $data["followers"]++; 
     68      $cache->write($fp, $data); 
    7069    } 
    7170  } 
     
    7675     
    7776    $cache = UserCache::getInstance(); 
     77    list ($fp, $data) = $cache->lock($userId); 
    7878     
    79     if ($data = $cache->read($userId)) { 
    80       if ($fp = $cache->lock($userId)) { 
    81         $data["friends"]--; 
    82         $cache->write($fp, $data); 
    83       } 
     79    if ($data) { 
     80      $data["friends"]--; 
     81      $cache->write($fp, $data); 
    8482    } 
    8583     
    86     if ($data = $cache->read($targetId)) { 
    87       if ($fp = $cache->lock($targetId)) { 
    88         $data["followers"]--; 
    89         $cache->write($fp, $data); 
    90       } 
     84    list ($fp, $data) = $cache->lock($targetId); 
     85     
     86    if ($data) { 
     87      $data["followers"]--; 
     88      $cache->write($fp, $data); 
    9189    } 
    9290  }