On 26 January 2017 at 02:10, [email protected] <[email protected]> wrote:

> Ah ah :-D
>
> In my example I want to be able to do the calls without caching or with
> caching. Without for debugging because I amend the server side at times and
> want always fresh data (yes, I could have a cache with TTL of about
> nothing).
>
>
and why that could be the problem in my example? you can always implement
#at:ifAbsentPut: in the way you see fit..

cache disable.
x := cache at: #something ifAbsentPut: [ blah ]. "always calculates,
ignores the cache"
cache enable.
y := cache at: #something ifAbsentPut: [ blah ]. "prefers to calculate
once, reuse result"

you see what i mean?
in any case you can easily avoid repeating  same block twice.. that's for
sure.


> Memoization is useful for not having to write the caching thing all the
> time.
>
> DynamicVariables are darker magic that this, right?
>
> Phil
>
>
> On Thu, Jan 26, 2017 at 12:56 AM, Igor Stasenko <[email protected]>
> wrote:
>
>> Because caching are always comes with concerns, like when/where do we
>> want to drop cached results and recalculate them, if needed..
>> With memoization it seems like there's simply no such concern at all..
>> meaning that cached data will live forever since created once.. which is
>> never good
>> for dynamic system.. because i spent significant portion of my smalltalk
>> life hunting for leaks and immortal references that you cannot get rid of,
>> because some guy forgot to provide a nice and easy interface or api to
>> get rid of volatile data.. like open files or socket connections, session
>> etc etc..
>> and now.. let us welcome.. memoization. :)
>>
>> --
>> Best regards,
>> Igor Stasenko.
>>
>
>


-- 
Best regards,
Igor Stasenko.

Reply via email to