Exemplo n.º 1
0
        public virtual UUID Store(AssetBase asset)
        {
            object remoteValue = DoRemoteByURL("AssetServerURI", asset);

            if (remoteValue != null || m_doRemoteOnly)
            {
                if (remoteValue == null)
                {
                    return(UUID.Zero);
                }
                asset.ID = (UUID)remoteValue;
            }
            else
            {
                asset.ID = m_database.Store(asset);
            }
            IImprovedAssetCache cache = m_registry.RequestModuleInterface <IImprovedAssetCache>();

            if (doDatabaseCaching && cache != null && asset != null && asset.Data != null && asset.Data.Length != 0)
            {
                cache.Expire(asset.ID.ToString());
                cache.Cache(asset.ID.ToString(), asset);
            }

            return(asset != null ? asset.ID : UUID.Zero);
        }
Exemplo n.º 2
0
        public virtual UUID Store(AssetBase asset)
        {
            //MainConsole.Instance.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
            asset.ID = m_database.Store(asset);
            IImprovedAssetCache cache = m_registry.RequestModuleInterface <IImprovedAssetCache>();

            if (cache != null && asset != null && asset.Data != null && asset.Data.Length != 0)
            {
                cache.Expire(asset.ID.ToString());
                cache.Cache(asset);
            }

            return(asset != null ? asset.ID : UUID.Zero);
        }
Exemplo n.º 3
0
        public virtual UUID Store(AssetBase asset)
        {
            // this should never happen but...
            if (asset != null)
            {
                if (m_doRemoteOnly)
                {
                    object remoteValue = DoRemoteByURL("AssetServerURI", asset);
                    if (remoteValue != null)
                    {
                        asset.ID = (UUID)remoteValue;
                    }
                    else
                    {
                        return(UUID.Zero);
                    }
                }
                else
                {
                    asset.ID = m_database.Store(asset);
                }

                if (doDatabaseCaching)
                {
                    IImprovedAssetCache cache = m_registry.RequestModuleInterface <IImprovedAssetCache> ();
                    if (cache != null && asset.Data.Length != 0)
                    {
                        cache.Expire(asset.ID.ToString());
                        cache.Cache(asset.ID.ToString(), asset);
                    }
                }

                return(asset.ID);
            }

            MainConsole.Instance.Error("[Asset service]: Trying to store a null asset!");
            return(UUID.Zero);
        }
Exemplo n.º 4
0
        public virtual UUID Store(AssetBase asset)
        {
            object remoteValue = DoRemote(asset);

            if (remoteValue != null || m_doRemoteOnly)
            {
                asset.ID = (UUID)remoteValue;
            }
            else
            {
                //MainConsole.Instance.DebugFormat("[ASSET SERVICE]: Store asset {0} {1}", asset.Name, asset.ID);
                asset.ID = m_database.Store(asset);
            }
            IImprovedAssetCache cache = m_registry.RequestModuleInterface <IImprovedAssetCache>();

            if (doDatabaseCaching && cache != null && asset != null && asset.Data != null && asset.Data.Length != 0)
            {
                cache.Expire(asset.ID.ToString());
                cache.Cache(asset.ID.ToString(), asset);
            }

            return(asset != null ? asset.ID : UUID.Zero);
        }