Пример #1
0
        public virtual AssetBase Get(string id)
        {
            IImprovedAssetCache cache = m_registry.RequestModuleInterface <IImprovedAssetCache>();

            if (doDatabaseCaching && cache != null)
            {
                bool      found;
                AssetBase cachedAsset = cache.Get(id, out found);
                if (found && (cachedAsset == null || cachedAsset.Data.Length != 0))
                {
                    return(cachedAsset);
                }
            }
            object remoteValue = DoRemote(id);

            if (remoteValue != null || m_doRemoteOnly)
            {
                if (doDatabaseCaching && cache != null)
                {
                    cache.Cache(id, (AssetBase)remoteValue);
                }
                return((AssetBase)remoteValue);
            }

            AssetBase asset = m_database.GetAsset(UUID.Parse(id));

            if (doDatabaseCaching && cache != null)
            {
                cache.Cache(id, asset);
            }
            return(asset);
        }
Пример #2
0
        public AssetBase Get(string id)
        {
            UUID assetID;

            if (!UUID.TryParse(id, out assetID))
            {
                m_log.WarnFormat("[ASSET SERVICE]: Could not parse requested sset id {0}", id);
                return(null);
            }

            return(m_Database.GetAsset(assetID));
        }
        AssetBase CheckForConversion(string id)
        {
            if (!m_migrateSQL)
            {
                return(null);
            }

            AssetBase asset;

            asset = m_assetService.GetAsset(UUID.Parse(id));

            if (asset == null)
            {
                return(null);
            }

            //Delete first, then restore it with the new local flag attached, so that we know we've converted it
            //m_assetService.Delete(asset.ID, true);
            //asset.Flags = AssetFlags.Local;
            //m_assetService.StoreAsset(asset);

            //Now store in Redis
            RedisSetAsset(asset);

            return(asset);
        }
Пример #4
0
        public virtual AssetBase Get(string id, bool showWarnings)
        {
            if (id == UUID.Zero.ToString())
            {
                return(null);
            }

            IImprovedAssetCache cache = m_registry.RequestModuleInterface <IImprovedAssetCache> ();

            if (doDatabaseCaching && cache != null)
            {
                bool      found;
                AssetBase cachedAsset = cache.Get(id, out found);
                if (found)
                {
                    if (cachedAsset != null && cachedAsset.Data != null)
                    {
                        return(cachedAsset);
                    }
                }
            }

            if (m_doRemoteOnly)
            {
                object remoteValue = DoRemoteByURL("AssetServerURI", id, showWarnings);
                if (remoteValue != null)
                {
                    if (doDatabaseCaching && cache != null)
                    {
                        cache.Cache(id, (AssetBase)remoteValue);
                    }
                    return((AssetBase)remoteValue);
                }
                return(null);
            }

            AssetBase asset = m_database.GetAsset(UUID.Parse(id), showWarnings);

            if (doDatabaseCaching && cache != null)
            {
                cache.Cache(id, asset);
            }
            return(asset);
        }
Пример #5
0
        public virtual AssetBase Get(string id)
        {
            IImprovedAssetCache cache = m_registry.RequestModuleInterface <IImprovedAssetCache>();

            if (cache != null)
            {
                AssetBase cachedAsset = cache.Get(id);
                if (cachedAsset != null && cachedAsset.Data.Length != 0)
                {
                    return(cachedAsset);
                }
            }
            AssetBase asset = m_database.GetAsset(UUID.Parse(id));

            if (cache != null && asset != null)
            {
                cache.Cache(asset);
            }
            return(asset);
        }
Пример #6
0
        private AssetBase CheckForConversion(string id)
        {
            if (!m_doConversion)
            {
                return(null);
            }

            AssetBase asset;

            asset = m_assetService.GetAsset(UUID.Parse(id));

            if (asset == null)
            {
                return(null);
            }

            //Now store in Redis
            RedisSetAsset(asset);

            return(asset);
        }