Re: Changing write output file on the fly

2015-07-31 Thread James Reeves
On 31 July 2015 at 17:18, Marcin Jurczuk wrote: > > Some reading is required to understand your code (never used volatile!) > but thanks for direction. > I will try this way. > Volatiles were introduced in Clojure 1.7.0, and trade thread-safety for better performance. I could have used an atom fo

Re: Changing write output file on the fly

2015-07-31 Thread Marcin Jurczuk
Mars0i, I've tried spit but it looks like there is no caching under the hood and it's using syscalls open, write, close every time it is called, and this spikes system resources. with-open - we will see :) W dniu piątek, 31 lipca 2015 16:41:19 UTC+2 użytkownik Mars0i napisał: > > with-open

Re: Changing write output file on the fly

2015-07-31 Thread Marcin Jurczuk
James, Some reading is required to understand your code (never used volatile!) but thanks for direction. I will try this way. W dniu piątek, 31 lipca 2015 17:39:50 UTC+2 użytkownik James Reeves napisał: > > The way I'd do it is to write a function that caches the output writer or > stream. Whe

Re: Changing write output file on the fly

2015-07-31 Thread James Reeves
The way I'd do it is to write a function that caches the output writer or stream. When the cache expires, the function closes the old writer and opens a new one to the new file. In the example below, I'm assuming you have a function that returns the same name for the same hour. (let [cache (volat

Re: Changing write output file on the fly

2015-07-31 Thread Mars0i
with-open and spit might be useful. You could also rebind *out*. That may be enough to point you in the right direction, but this page

Changing write output file on the fly

2015-07-31 Thread Marcin Jurczuk
Hi all, This is my first post here so please be compassionate :) I'm evaluating clojure for some of my purposes and I've stuck on task that I don't know to handle. I have applicatin that is receiving a lot of data and writing some results to a file. However once per hour this output file must