/**
  * Given a name, check the cache if the model is cached and return. Otherwise check the database for the record,
  * cache and return this model.
  * @param string $name
  */
 public static function getByName($name)
 {
     assert('is_string($name)');
     assert('$name != ""');
     try {
         return GeneralCache::getEntry('NamedSecurableItem' . $name);
     } catch (NotFoundException $e) {
         $bean = R::findOne('namedsecurableitem', "name = :name ", array(':name' => $name));
         assert('$bean === false || $bean instanceof RedBean_OODBBean');
         if ($bean === false) {
             $model = new NamedSecurableItem();
             $model->unrestrictedSet('name', $name);
         } else {
             $model = self::makeModel($bean);
         }
     }
     GeneralCache::cacheEntry('NamedSecurableItem' . $name, $model);
     return $model;
 }
 /**
  * Given a name, check the cache if the model is cached and return. Otherwise check the database for the record,
  * cache and return this model.
  * @param string $name
  */
 public static function getByName($name)
 {
     assert('is_string($name)');
     assert('$name != ""');
     try {
         // not using default value to save cpu cycles on requests that follow the first exception.
         return GeneralCache::getEntry('NamedSecurableItem' . $name);
     } catch (NotFoundException $e) {
         $bean = ZurmoRedBean::findOne('namedsecurableitem', "name = :name ", array(':name' => $name));
         assert('$bean === false || $bean instanceof RedBean_OODBBean');
         if ($bean === false) {
             $model = new NamedSecurableItem();
             $model->unrestrictedSet('name', $name);
         } else {
             $model = self::makeModel($bean);
         }
     }
     GeneralCache::cacheEntry('NamedSecurableItem' . $name, $model);
     return $model;
 }