This very minor update adds an interface for the WriteAsClient class, which opens it up for use with dependency injection in ASP.NET Core. This allows you to create a single WriteAsClient instance and re-use it when needed, making the caching additions from Version 1.2.0 much more useful.
This also frees me up to make better use of it in the API I'm working on.
You can install it via nuget:
Install-Package WriteAs.NET -Version 1.2.1
Or via the .NET Core command line interface:
dotnet add package WriteAs.NET --version 1.2.1
If you find any bugs or issues with it, please let me know. Thanks and y'all have a good night.
This latest version now allows you to enter an API key when initializing a WriteAsClient instance. This API key will allow you to bypass the rate limiting checks on the Write.as API.
Some basic in-memory caching has also been added to the client. You can configure some of the cache settings when initializing a WriteAsClient instance. The new settings are described below:
cacheExpirationInSeconds determines how long data will stay in the cache before it expires. The default value for this setting is 300 seconds.
cacheSize determines how many objects it can store in the cache. Note that a collection of posts (List<Post>) and a single post each count as 1 item. The default value for this setting is 4.
You can install it via nuget:
Install-Package WriteAs.NET -Version 1.2.0
Or via the .NET Core command line interface:
dotnet add package WriteAs.NET --version 1.2.0
If you find any bugs or issues with it, please let me know. Thanks and y'all have a good weekend.
I'm working on an update to the WriteAs.Net client/wrapper library. In a previous post I talked about adding caching to it before I release a new version. I ran into some road-blocks that derailed me. I ended up pushing it off to the side to focus my time somewhere else.
The two issues that I ran into were: figuring out what the cache key was going to be for the cached object and removing the oldest object in the cache. I now have solutions for those issues.
For the cache keys, I figured I could use the method name plus the parameter values.
For clearing out the oldest cached object, I decided to make use of a generic Queue collection that could accept the cache key values. Then I could just pop-off the oldest value from the Queue and use that to remove the associated object in the cache.
And so anyway, I should have the updated version of the client/wrapper library out soon. I just need to do some more testing on it.
Due to the rate-limiting feature that the Write.as team introduced into their API, a number of my Blazor WASM apps, like the WriteFreely Archive Page Generator I created, have stopped working. All of the Write.as related Blazor WASM apps I created, use the WriteAs.Net client/wrapper library that I wrote. And it is actually this client/wrapper library that is running into the rate-limiting problem.
But, as Matt mentioned here, a solution is in place through the use of Application keys.
I've already updated the WriteAs.Net client to make use of Application keys. But before I release the latest version, I also want to give it some caching abilities. That's what I'm working on and testing right now in my spare time. Once that's done, I'll publish the latest version of the WriteAs.Net client to Nuget.
After that, I plan to get the WriteFreely Archive Page Generator working once again. Then I'll work on getting the Search app for my journal working as well.