Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Persist LastModifed time stamp in DB, it required cache invalidation …
Browse files Browse the repository at this point in the history
…when platform run in multiple instances
  • Loading branch information
tatarincev committed May 3, 2017
1 parent c0d33b1 commit 3e6ef77
Show file tree
Hide file tree
Showing 33 changed files with 720 additions and 124 deletions.
29 changes: 29 additions & 0 deletions CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalAssemblyInfo.cs" company="VirtoCommerce">
// Copyright © VirtoCommerce. All rights reserved.
// </copyright>
// <summary>
// Virto Commerce
// </summary>
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

using System;
using System.Reflection;
using System.Runtime.InteropServices;

[assembly: AssemblyCompany("VirtoCommerce")]
[assembly: AssemblyTitle("VirtoCommerce.CacheModule.Web")]

[assembly: AssemblyCopyright("Copyright © VirtoCommerce 2011-2017")]

[assembly: AssemblyFileVersion("1.0.10.0")]
[assembly: AssemblyVersion("1.0.10.0")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif

[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
17 changes: 17 additions & 0 deletions VirtoCommerce.CacheModule.Data/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>

<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /></startup></configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using VirtoCommerce.Platform.Core.Settings;
using VirtoCommerce.Platform.Data.Common;

namespace VirtoCommerce.CacheModule.Web.Decorators
namespace VirtoCommerce.CacheModule.Data.Decorators
{
internal sealed class CacheManagerAdaptor
public sealed class CacheManagerAdaptor
{
private readonly ICacheManager<object> _cacheManager;
private readonly ISettingsManager _settingManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using VirtoCommerce.CacheModule.Web.Extensions;
using VirtoCommerce.CacheModule.Web.Services;
using VirtoCommerce.CacheModule.Data.Extensions;
using VirtoCommerce.Domain.Catalog.Model;
using VirtoCommerce.Domain.Catalog.Services;

namespace VirtoCommerce.CacheModule.Web.Decorators
namespace VirtoCommerce.CacheModule.Data.Decorators
{
internal sealed class CatalogServicesDecorator : ICachedServiceDecorator, IItemService, ICatalogSearchService, IPropertyService, ICategoryService, ICatalogService
public sealed class CatalogServicesDecorator : ICachedServiceDecorator, IItemService, ICatalogSearchService, IPropertyService, ICategoryService, ICatalogService
{
private readonly IItemService _itemService;
private readonly ICatalogSearchService _searchService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using VirtoCommerce.CacheModule.Web.Services;
using VirtoCommerce.Domain.Commerce.Model;
using VirtoCommerce.Domain.Commerce.Services;

namespace VirtoCommerce.CacheModule.Web.Decorators
namespace VirtoCommerce.CacheModule.Data.Decorators
{
internal sealed class CommerceServiceDecorator : ICachedServiceDecorator, ICommerceService
public sealed class CommerceServiceDecorator : ICachedServiceDecorator, ICommerceService
{
private readonly ICommerceService _commerceService;
private readonly IList<ICachedServiceDecorator> _allSeoInfoRelatedDecorators;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace VirtoCommerce.CacheModule.Data.Decorators
{
public interface ICachedServiceDecorator
{
void ClearCache();
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
using System;
using System.Collections.Generic;
using VirtoCommerce.CacheModule.Web.Extensions;
using VirtoCommerce.CacheModule.Web.Services;
using VirtoCommerce.CacheModule.Data.Extensions;
using VirtoCommerce.Domain.Commerce.Model.Search;
using VirtoCommerce.Domain.Marketing.Model;
using VirtoCommerce.Domain.Marketing.Model.Promotions.Search;
using VirtoCommerce.Domain.Marketing.Services;
using VirtoCommerce.Domain.Store.Model;
using VirtoCommerce.Domain.Store.Services;
using VirtoCommerce.Platform.Core.Security;

namespace VirtoCommerce.CacheModule.Web.Decorators
namespace VirtoCommerce.CacheModule.Data.Decorators
{
internal sealed class MarketingServicesDecorator : ICachedServiceDecorator, IDynamicContentService, IPromotionSearchService, IPromotionService, ICouponService
public sealed class MarketingServicesDecorator : ICachedServiceDecorator, IDynamicContentService, IPromotionSearchService, IPromotionService, ICouponService
{
private readonly CacheManagerAdaptor _cacheManager;
private readonly IDynamicContentService _contentService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
using System;
using VirtoCommerce.CacheModule.Web.Extensions;
using VirtoCommerce.CacheModule.Web.Services;
using VirtoCommerce.CacheModule.Data.Extensions;
using VirtoCommerce.Domain.Commerce.Model.Search;
using VirtoCommerce.Domain.Customer.Model;
using VirtoCommerce.Domain.Customer.Services;
using VirtoCommerce.Platform.Core.Common;

namespace VirtoCommerce.CacheModule.Web.Decorators
namespace VirtoCommerce.CacheModule.Data.Decorators
{
internal sealed class MemberServicesDecorator : ICachedServiceDecorator, IMemberService, IMemberSearchService
public sealed class MemberServicesDecorator : ICachedServiceDecorator, IMemberService, IMemberSearchService
{
private readonly IMemberService _memberService;
private readonly IMemberSearchService _memberSearchService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
using VirtoCommerce.CacheModule.Web.Extensions;
using VirtoCommerce.CacheModule.Web.Services;
using System.Collections.Generic;
using VirtoCommerce.CacheModule.Data.Extensions;
using VirtoCommerce.Domain.Store.Model;
using VirtoCommerce.Domain.Store.Services;
using VirtoCommerce.Platform.Core.Security;

namespace VirtoCommerce.CacheModule.Web.Decorators
namespace VirtoCommerce.CacheModule.Data.Decorators
{
internal sealed class StoreServicesDecorator : ICachedServiceDecorator, IStoreService
public sealed class StoreServicesDecorator : ICachedServiceDecorator, IStoreService
{
private readonly CacheManagerAdaptor _cacheManager;
private readonly IStoreService _storeService;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using VirtoCommerce.Platform.Core.Common;

namespace VirtoCommerce.CacheModule.Data.Extensions
{
public static class SerializationExtension
{
public static string ToJson<T>(this T source) where T : class, new()
{
var retVal = string.Empty;
using (var memStream = new MemoryStream())
{
source.SerializeJson(memStream);
memStream.Seek(0, SeekOrigin.Begin);
retVal = memStream.ReadToString();
}
return retVal;
}


}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace VirtoCommerce.CacheModule.Data.Migrations
{
using System;
using System.Data.Entity.Migrations;

public partial class Initial : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.LastModified",
c => new
{
Id = c.String(nullable: false, maxLength: 128),
Scope = c.String(maxLength: 256),
LastModifiedDate = c.DateTime(nullable: false),
})
.PrimaryKey(t => t.Id)
.Index(t => t.Scope, unique: true);

}

public override void Down()
{
DropIndex("dbo.LastModified", new[] { "Scope" });
DropTable("dbo.LastModified");
}
}
}
126 changes: 126 additions & 0 deletions VirtoCommerce.CacheModule.Data/Migrations/201705030749284_Initial.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name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xwe5O/uNG00+J7RGeK3y0fnjxyRnTZ95vBLTxx9RY2gFSuNBhXa79K9ejh2y9Zju38D3hVYsWkgsn8DBUEWwwa0opmrta7CgUbvalSRtKK1AMcxMvzSOLHmgcPnAKzNt6pHLhMkuY5WEM7VfeLixF1aC9FK7i0DHjsuP98A9nX27uPsZH+ECaimyJLrXv2eCBnWet/0JNcBiCyN/gC8z2sDt0qE26Q10p1WJwKV7ruCGLC+lFsCbgQIZu+Vz5/hNbrhfncLGx6kVfc9DPJyIPbd7l0JvjE8siVGw5/94bLsF/f9NxNxg+QUDwAA</value>
</data>
<data name="DefaultSchema" xml:space="preserve">
<value>dbo</value>
</data>
</root>
Loading

0 comments on commit 3e6ef77

Please sign in to comment.