Skip to content

Instantly share code, notes, and snippets.

@davybrion
Created September 10, 2012 19:57
Show Gist options
  • Save davybrion/3693436 to your computer and use it in GitHub Desktop.
Save davybrion/3693436 to your computer and use it in GitHub Desktop.
code snippets for "Using Agatha’s Server-Side Caching" post
[EnableServiceResponseCaching(Minutes = 10, Region = "Issues")]
public class GetUnassignedIssuesForProjectRequest : Request
{
public Guid ProjectId { get; set; }
}
[EnableServiceResponseCaching(Minutes = 10, Region = "Issues")]
public class GetUnassignedIssuesForProjectRequest : Request
{
public Guid ProjectId { get; set; }
public bool Equals(GetUnassignedIssuesForProjectRequest other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return other.ProjectId.Equals(ProjectId);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != typeof(GetUnassignedIssuesForProjectRequest)) return false;
return Equals((GetUnassignedIssuesForProjectRequest)obj);
}
public override int GetHashCode()
{
return ProjectId.GetHashCode();
}
}
[EnableServiceResponseCaching(Hours = 2, Region = "ReferenceData")]
public class GetAllCountriesRequest : Request {}
[EnableServiceResponseCaching(Hours = 2, Region = "ReferenceData")]
public class GetAllCountriesRequest : Request
{
private string dummyValue = typeof(GetAllCountriesRequest).FullName;
public bool Equals(GetAllCountriesRequest other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return Equals(other.dummyValue, dummyValue);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != typeof(GetAllCountriesRequest)) return false;
return Equals((GetAllCountriesRequest)obj);
}
public override int GetHashCode()
{
return dummyValue.GetHashCode();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment