Showing posts with label insert. Show all posts
Showing posts with label insert. Show all posts

Saturday, March 24, 2012

Newbie: Questions about Cache object

Hi,
I'm trying to use Cache object for the first item. I've some questions
about that:
(1) Should Add, Remove and Insert method calls need to be synchronized ?
(2) Is it possible to add a cache dependency for cascading deletes i.e. if
cache key A is removed(based on time based expiration), so is key B which is
depnedent on it ?
Thanks in advance and regards
Navin1) If you want to be absolutely threadsafe using the Cache, use the Lock
keyword in your insert etc. methods.
2) Cascading deletes from the cache should be easy to implement using the
CacheItemRemovedCallback delegate , where in the callback target for item A
you would go ahead and remove Item B.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
"Navin Mishra" wrote:

> Hi,
> I'm trying to use Cache object for the first item. I've some questions
> about that:
> (1) Should Add, Remove and Insert method calls need to be synchronized ?
> (2) Is it possible to add a cache dependency for cascading deletes i.e. if
> cache key A is removed(based on time based expiration), so is key B which
is
> depnedent on it ?
> Thanks in advance and regards
> Navin
>
>
Thanks for quick response. For (2), is there any example ? In callback, how
I access the Cache object as it is part og request context ? Can a key item
dependency be used instead ?
Thanks again and regards
"Peter Bromberg [C# MVP]" <pbromberg@.yahoo.nospammin.com> wrote in message
news:CA9F6ABA-FF0B-40EA-BAB2-D2077B90670C@.microsoft.com...
> 1) If you want to be absolutely threadsafe using the Cache, use the Lock
> keyword in your insert etc. methods.
> 2) Cascading deletes from the cache should be easy to implement using the
> CacheItemRemovedCallback delegate , where in the callback target for item
A
> you would go ahead and remove Item B.
> Peter
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
> "Navin Mishra" wrote:
>
if
which is

Newbie: Questions about Cache object

Hi,

I'm trying to use Cache object for the first item. I've some questions
about that:

(1) Should Add, Remove and Insert method calls need to be synchronized ?
(2) Is it possible to add a cache dependency for cascading deletes i.e. if
cache key A is removed(based on time based expiration), so is key B which is
depnedent on it ?

Thanks in advance and regards

Navin1) If you want to be absolutely threadsafe using the Cache, use the Lock
keyword in your insert etc. methods.

2) Cascading deletes from the cache should be easy to implement using the
CacheItemRemovedCallback delegate , where in the callback target for item A
you would go ahead and remove Item B.

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com

"Navin Mishra" wrote:

> Hi,
> I'm trying to use Cache object for the first item. I've some questions
> about that:
> (1) Should Add, Remove and Insert method calls need to be synchronized ?
> (2) Is it possible to add a cache dependency for cascading deletes i.e. if
> cache key A is removed(based on time based expiration), so is key B which is
> depnedent on it ?
> Thanks in advance and regards
> Navin
>
Thanks for quick response. For (2), is there any example ? In callback, how
I access the Cache object as it is part og request context ? Can a key item
dependency be used instead ?

Thanks again and regards

"Peter Bromberg [C# MVP]" <pbromberg@.yahoo.nospammin.com> wrote in message
news:CA9F6ABA-FF0B-40EA-BAB2-D2077B90670C@.microsoft.com...
> 1) If you want to be absolutely threadsafe using the Cache, use the Lock
> keyword in your insert etc. methods.
> 2) Cascading deletes from the cache should be easy to implement using the
> CacheItemRemovedCallback delegate , where in the callback target for item
A
> you would go ahead and remove Item B.
> Peter
> --
> Co-founder, Eggheadcafe.com developer portal:
> http://www.eggheadcafe.com
> UnBlog:
> http://petesbloggerama.blogspot.com
>
>
> "Navin Mishra" wrote:
> > Hi,
> > I'm trying to use Cache object for the first item. I've some questions
> > about that:
> > (1) Should Add, Remove and Insert method calls need to be synchronized ?
> > (2) Is it possible to add a cache dependency for cascading deletes i.e.
if
> > cache key A is removed(based on time based expiration), so is key B
which is
> > depnedent on it ?
> > Thanks in advance and regards
> > Navin

Friday, March 16, 2012

newline in an email

i need to insert a newline in my email's body but didn't work. I tried borth "\r\n" and Environment.Newine

This is my code:

email_body = "???? ??? ???? ??? ??? ???????";
email_body += Environment.NewLine + Environment.NewLine;
email_body += "??? ????? ??????? ?????? ?????? ?? ??????? ???? ??? ????. ??? ??? ?? ???? ????? ?? ????? ?? ?????? ?????? ???? ??????? ???.";
email_body += "\n\r";
email_body += "????? ??????: " + sql_reader["member_cpr"];
email_body += "\n\r";
email_body += "???? ????: " + sql_reader["member_password"];

If the E-Mail is in HTML format, you can use <br /> as an HTML Break.

newline within a string

How can I insert a new line character (\n?) within a string in C#, so that when I display the string in some text box the string is displayed in multiple linesHi,

you can use System.Envirnment.NewLine() method to insert newline. Also if you are using Multiline textbox then I think you need to do something like this:


string AllText = TextBox1.Text.Replace(System.Envirnment.NewLine(),"<BR>");


What I am trying to do is

string strnewline;
TextBox1.text=strnewline;

Now I want to define the strnewline such that
TextBox1.text=strnewline;

displays the text in multiple lines. TextBox1 is multilined.

In short, is there any alternative to C-lang "/n " ?
check the code that I gave you it works !!!!