Browse Source

Fixed cache bug.

Former-commit-id: 3ec039a00e918e4c03a21a21d2b5e48e375bf916
af/merge-core
JimBobSquarePants 14 years ago
parent
commit
a1e6ffd99e
  1. 27
      src/ImageProcessor.Web/Caching/DiskCache.cs
  2. 4
      src/ImageProcessor.Web/Properties/AssemblyInfo.cs
  3. 1
      src/Nuget/ImageProcessor.Web.2.2.0.1.nupkg.REMOVED.git-id
  4. 43
      src/Nuget/ImageProcessor.Web.2.2.0.1.nuspec
  5. 4
      src/Test/Test/Web.config

27
src/ImageProcessor.Web/Caching/DiskCache.cs

@ -283,7 +283,7 @@ namespace ImageProcessor.Web.Caching
{ {
// Check to see if the last write time is different of whether the // Check to see if the last write time is different of whether the
// cached image is set to expire or if the max age is different. // cached image is set to expire or if the max age is different.
if (imageFileInfo.LastWriteTimeUtc != cachedImage.LastWriteTimeUtc if (!this.RoughDateTimeCompare(imageFileInfo.LastWriteTimeUtc, cachedImage.LastWriteTimeUtc)
|| cachedImage.ExpiresUtc < DateTime.UtcNow.AddDays(-MaxFileCachedDuration) || cachedImage.ExpiresUtc < DateTime.UtcNow.AddDays(-MaxFileCachedDuration)
|| cachedImage.MaxAge != MaxFileCachedDuration) || cachedImage.MaxAge != MaxFileCachedDuration)
{ {
@ -461,6 +461,31 @@ namespace ImageProcessor.Web.Caching
return match.Success ? match.Value : string.Empty; return match.Success ? match.Value : string.Empty;
} }
/// <summary>
/// The rough date time compare.
/// </summary>
/// <param name="first">
/// The first.
/// </param>
/// <param name="second">
/// The second.
/// </param>
/// <returns>
/// The <see cref="bool"/> true if the DateTimes roughly compare; otherwise, false.
/// </returns>
private bool RoughDateTimeCompare(DateTime first, DateTime second)
{
var x = first.ToString(CultureInfo.InvariantCulture);
var y = second.ToString(CultureInfo.InvariantCulture);
if (first.ToString(CultureInfo.InvariantCulture) == second.ToString(CultureInfo.InvariantCulture))
{
return true;
}
return false;
}
#endregion #endregion
#endregion #endregion
} }

4
src/ImageProcessor.Web/Properties/AssemblyInfo.cs

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("2.2.0.0")] [assembly: AssemblyVersion("2.2.0.1")]
[assembly: AssemblyFileVersion("2.2.0.0")] [assembly: AssemblyFileVersion("2.2.0.1")]

1
src/Nuget/ImageProcessor.Web.2.2.0.1.nupkg.REMOVED.git-id

@ -0,0 +1 @@
8a3fd4491298fec4626034f03e534caac7f22941

43
src/Nuget/ImageProcessor.Web.2.2.0.1.nuspec

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ImageProcessor.Web</id>
<version>2.2.0.1</version>
<title>ImageProcessor.Web</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://jimbobsquarepants.github.com/ImageProcessor/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>ImageProcessor.Web adds a configurable HttpModule to your website which allows on-the-fly processing of image files. The module also comes with a file and browser based cache that can handle up to 12,960,000 images increasing your processing output and saving precious server memory.
Methods include; Resize, Rotate, Flip, Crop, Watermark, Filter, Saturation, Brightness, Contrast, Quality, Format, Vignette, and Transparency.
This package also requires Microsoft.Bcl.Async -pre on .NET 4.0 which will be added in the background on install if applicable.
If you use ImageProcessor please get in touch via my twitter @james_m_south
Feedback is always welcome.</description>
<summary>An extension to ImageProcessor that allows on-the-fly processing of image files in an ASP.NET website</summary>
<releaseNotes>Fixed cache bug which caused unneccessary processing of images.
If upgrading from &lt; 2.2.0.0 You will have to delete your cache if upgrading to this version as the database differs.</releaseNotes>
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image, Imaging, ASP, Performance, Processing, HttpModule, Cache, Resize, Rotate, Flip, Crop, Filter, Effects, Quality, Watermark, Alpha, Vignette, Saturation, Brightness, Contrast, Gif, Jpeg, Bitmap, Png, Fluent</tags>
<dependencies>
<dependency id="ImageProcessor" version="1.5.0.0" />
<dependency id="Csharp-Sqlite" version="3.7.7.1" />
</dependencies>
</metadata>
<files>
<file src="content\net40\web.config.transform" target="content\net40\web.config.transform" />
<file src="content\net45\web.config.transform" target="content\net45\web.config.transform" />
<file src="..\ImageProcessor.Web\bin\Release\ImageProcessor.Web.dll" target="lib\net40\ImageProcessor.Web.dll" />
<file src="lib\net40\System.Runtime.dll" target="lib\net40\System.Runtime.dll" />
<file src="lib\net40\System.Threading.Tasks.dll" target="lib\net40\System.Threading.Tasks.dll" />
<file src="..\ImageProcessor.Web\bin\Release\ImageProcessor.Web.dll" target="lib\net45\ImageProcessor.Web.dll" />
<file src="tools\net40\install.ps1" target="tools\net40\install.ps1" />
<file src="tools\net45\install.ps1" target="tools\net45\install.ps1" />
</files>
</package>

4
src/Test/Test/Web.config

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0"?>
<!-- <!--
For more information on how to configure your ASP.NET application, please visit For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368 http://go.microsoft.com/fwlink/?LinkId=152368
@ -18,7 +18,7 @@
<add key="UnobtrusiveJavaScriptEnabled" value="true"/> <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings> </appSettings>
<system.web> <system.web>
<compilation debug="false" targetFramework="4.0"> <compilation debug="true" targetFramework="4.0">
<assemblies> <assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Loading…
Cancel
Save