Store an object in the cache (this allows temporarily assigning a new cache
        for exploring the DB without affecting the stored version
543131
def cache(self, obj):
        '''
        
        '''
        # Check cache path exists for current obj
        write_path = os.path.join( self.cache_path, obj.org_id )
        if not os.path.exists( write_path ): 
            mkdir_p( write_path )

        with open(os.path.join( write_path, obj.id ), 'wb') as f:
            pickle.dump( obj, f )
        
        # Add to localstore (keep track of numbers of objects, etc.)
        self.add_to_localstore(obj)   
        self.add_to_names(obj)
747377
def store(self, obj, distinct=False):
        '''
        
        '''
        if distinct:
            fields = dict(zip(self._tables[obj._TABLE].keys(),
                              obj._serialize(self._tables[obj._TABLE])))
            db_obj = self.get(obj.__class__, eq=fields)
            if db_obj and distinct:
                raise Exception("Object already in the database.")
        with gzip.open(os.path.join(self.db_path, obj._TABLE), 'a') as table:
            csv.writer(table).writerow(self._validate_object(obj))
380422
def cache_write(obj)
      # This is just a safety check. It can probably be disabled in the future
      # to increase performance.
      if obj.respond_to?(:is_poxreference?)
        # If this condition triggers, we have a bug in the library.
        PEROBS.log.fatal "POXReference objects should never be cached"
      end

      if @transaction_stack.empty?
        # We are not in transaction mode.
        idx = index(obj)
        if (old_obj = @writes[idx]) && old_obj._id != obj._id
          # There is another old object using this cache slot. Before we can
          # re-use the slot, we need to sync it to the permanent storage.
          old_obj._sync
        end
        @writes[idx] = obj
      else
        # When a transaction is active, we don't have a write cache. The read
        # cache is used to speed up access to recently used objects.
        cache_read(obj)
        # Push the reference of the modified object into the write buffer for
        # this transaction level.
        unless @transaction_stack.last.include?(obj._id)
          @transaction_stack.last << obj._id
          @transaction_objects[obj._id] = obj
        end
      end
    end
1007121
def save(self, obj):
        
        if obj not in self.session:
            self.session.add(obj)
        else:
            obj = self.session.merge(obj)
        self.session.flush()
        self.session.refresh(obj)
        return obj
784005
def reload(options = nil)
      options = (options || {}).merge(no_obfuscated_id: true)

      clear_aggregation_cache
      clear_association_cache

      fresh_object =
        if options && options[:lock]
          self.class.unscoped { self.class.lock(options[:lock]).find(id, options) }
        else
          self.class.unscoped { self.class.find(id, options) }
        end

      @attributes = fresh_object.instance_variable_get('@attributes')
      @new_record = false
      self
    end
527579
def save(self, commit=False):
        
        if not has_identity(self):
            # Object has not been persisted to the database.
            session.add(self)

        if commit:
            # Commit the session as requested.
            session.commit()

        else:
            # Just flush the session; do not commit.
            session.flush()
1321560
public void put(DBObject key, Object object) {
        //noinspection unchecked
        objectCache.put(flatten(key.toMap()), new WeakReference(object));
    }
345584
def store(key, value, options = {})
      @cache.store(key, value, options)
      @adapter.store(key, value, options)
    end
762102
public void restore(CachedObject object) {

        writeLock.lock();

        try {
            int i = object.getPos();

            cache.put(i, object);

            // was previously used for text tables
            if (storeOnInsert) {
                saveRow(object);
            }
        } finally {
            writeLock.unlock();
        }
    }
1181119
def _update_cache(self):
        "  "
        expected_version = (self.registry._version, self._extra_registry._version)

        if self._last_version != expected_version:
            registry2 = Registry()

            # Copy all bindings from `self.registry`, adding our condition.
            for reg in (self.registry, self._extra_registry):
                for b in reg.key_bindings:
                    registry2.key_bindings.append(
                        _Binding(
                            keys=b.keys,
                            handler=b.handler,
                            filter=self.filter & b.filter,
                            eager=b.eager,
                            save_before=b.save_before))

            self._registry2 = registry2
            self._last_version = expected_version
635949
function (obj, cache) {
    if ( cache === void 0 ) cache = [];

    var t$ = Tool;
    // just return if obj is immutable value
    if (obj === null || typeof obj !== 'object') {
      return obj
    }

    // if obj is hit, it is in circular structure
    var hit = t$.find(cache, function (c) { return c.original === obj; });
    if (hit) {
      return hit.copy
    }

    var copy = Array.isArray(obj) ? [] : {};
    // put the copy into cache at first
    // because we want to refer it in recursive deepCopy
    cache.push({
      original: obj,
      copy: copy
    });

    Object.keys(obj).forEach(function (key) {
      copy[key] = t$.deepCopy(obj[key], cache);
    });

    return copy
  }
1366434
public void putCacheField()
    {
        try {
            Record record = this.getOwner();
            Object objKey = record.getHandle(DBConstants.OBJECT_ID_HANDLE);
            m_hsCache.add(objKey);
        } catch (DBException ex)    {
            ex.printStackTrace();
        }
    }
1159051
def save
      # Autoincremental ID unless specified
      unless @cached_attrs.include?(:id)
        add_attribute :id, @@redis.incr("#{self.class.name}:autoincrement")
        add_attribute :created_at, Time.now.to_f.to_s
        add_attribute :updated_at, Time.now.to_f.to_s
        @@redis.push_tail("#{self.class.name}:list", @cached_attrs[:id]) # List of all the class objects
      end

      # Store each @cached_attrs
      stored = Set.new
      (@cached_attrs.keys - @stored_attrs.to_a).each do |k|
          stored << k 
          @stored_attrs << k
          @@redis.set_add("#{self.class.name}:#{id}:attrs", k.to_s)
          @@redis.set("#{self.class.name}:#{@cached_attrs[:id]}:#{k}", @cached_attrs[k])
      end

      # updated_at
      @@redis.set("#{self.class.name}:#{@cached_attrs[:id]}:updated_at", Time.now.to_f.to_s)
      stored << :updated_at 

      # Relationships
      @@reflections[self.class.name.to_sym][:belongs_to].each do |klass|
        @@redis.set_add("#{klass.to_s.camelize}:#{@cached_attrs[klass.to_s.foreign_key.to_sym]}:_#{self.class.name.underscore}_ids", @cached_attrs[:id])
      end

      return stored.to_a
    end
1056392
def store(bank, key, data, cachedir=None):
    '''
    
    '''
    if cachedir is None:
        cachedir = __opts__['cachedir']

    try:
        cache = salt.cache.Cache(__opts__, cachedir=cachedir)
    except TypeError:
        cache = salt.cache.Cache(__opts__)
    return cache.store(bank, key, data)
489698
@Override
    public void save(T object, AccessControlContext accessControlContext)
            throws OptimisticLockException, AccessControlException, JeppettoException {
        ensureAccessControlEnabled();

        T enhancedEntity = dirtyableDBObjectEnhancer.enhance(object);
        DirtyableDBObject dbo = (DirtyableDBObject) enhancedEntity;

        if (dbo.isPersisted(dbCollection)) {
            verifyWriteAllowed(dbo, accessControlContext);
        } else {
            if (dbo.get(ID_FIELD) == null) {
                dbo.put(ID_FIELD, new ObjectId());  // If the id isn't explicitly set, assume intent is for mongo ids
            }

            assessAndAssignAccessControl(dbo, accessControlContext);
        }

        DBObject identifyingQuery = buildIdentifyingQuery(dbo);

        if (MongoDBSession.isActive()) {
            MongoDBSession.trackForSave(this, identifyingQuery, enhancedEntity, createIdentifyingQueries(dbo));
        } else {
            trueSave(identifyingQuery, dbo);
        }
    }
603094
def store_memory_object(self, mo, overwrite=True):
        

        for p in self._containing_pages_mo(mo):
            self._apply_object_to_page(p, mo, overwrite=overwrite)

        self._update_range_mappings(mo.base, mo.object, mo.length)
1023068
private void putToCache(final Element element, final Constraint object) {
		String id = element.getAttributeValue(XMLTags.ID);
		if (id != null && id.length() > 0) {
			Constraint old = putToCache(id, object);
			if (old != null) {
				LOG.warn("The id=" + id + " for object of type=" + old.getClass().getName()
						+ " was already found. Please make sure this is ok and no mistake.");
			}
		}
	}