Skip to content

Commit

Permalink
improve md
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jun 6, 2024
1 parent 2e0aa60 commit 87e44fc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
16 changes: 8 additions & 8 deletions docs/recipes/gateways-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
]
}
-->
## How does an Event Gateway work?
# How does an Event Gateway work?

An event gateway is a background process that continuously runs.

Expand All @@ -26,11 +26,11 @@ This looping and sleeping does not count for all types of event gateways. For ex

This "doing what it is designed for" will be explained in more detail underneath.

## Which gateways are available?
# Which gateways are available?

Lucee comes with 2 gateways: a Directory watcher and a Mail watcher.

### Directory watcher
## Directory watcher

This event gateway checks a given directory for file changes. These changes (events) can be:

Expand All @@ -44,7 +44,7 @@ Please note that the files in this first snapshot are NOT seen as changes!

So if you already have some files in the directory you want to watch, these files are not seen as "new file" when the gateway starts. Also, when Lucee (or your whole server) restarts, any changes which happened within this time are not seen and will not be picked up when the Directory watcher starts up again.

### Filters
## Filters

You can apply filters for what you exactly want to watch changes for:

Expand All @@ -53,11 +53,11 @@ You can apply filters for what you exactly want to watch changes for:

Note: the Extensions setting might be changed in the near future, due to an enhancement request.

### Mail watcher
## Mail watcher

This gateway checks a given POP mailbox for new mail. Since it only checks for new mail, it is rather limited in what it can do, but this is what makes it fast. The Mail watcher will read the inbox, and then check all the emails found.

### Logs
## Logs

Make sure you regularly check the logs, because when anything goes wrong, Lucee will report this in its logs.

Expand Down Expand Up @@ -90,7 +90,7 @@ For example, the above code would crash if a file with the same name already exi

It might be even wiser to just email the complete error dump, so you will be semi-instantly notified of any errors.

### Using cfadmin with Event gateways
## Using cfadmin with Event gateways

Instead of using the server/web admin, you can also use Lucee's `<cfadmin>` tag.

Expand All @@ -116,7 +116,7 @@ Add or update a gateway instance:
/>
```

### Remove a gateway instance
## Remove a gateway instance

```lucee
<cfadmin action="removeGatewayEntry" type="server" password="server-admin-password"
Expand Down
10 changes: 5 additions & 5 deletions docs/recipes/loop_through_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
]
}
-->
## Looping Through File ##
# Looping Through File

This document explains how to handle big files in Lucee in a better way. The classic way that you are familiar with uses cffile tag, fileRead, and fileReadBinary functions to read the file into memory. This is a simple solution, but it consumes a lot of memory.

### Example: Handle files with cffile tag, fileRead, and fileReadBinary functions
## Example: Handle files with cffile tag, fileRead, and fileReadBinary functions

```luceescript
include "_getPath2BigFile.cfm";
Expand All @@ -43,15 +43,15 @@ In the example above,

It consumes a lot of memory.

### Use Loop - File
## Use Loop - File

Use cfloop file. It allows you to read a file line by line, so you do not have to load an entire file into memory. You only load a line at a time into the memory.

```luceescript
<cfloop file="...">
```

### Example Using Loop
## Example Using Loop

```luceescript
include "_getPath2BigFile.cfm";
Expand All @@ -64,7 +64,7 @@ function handle(line) {}

In the above example, loop through the file and get each line, so in memory there is only ever the one line. This is not only faster, it also consumes less memory.

### Footnotes
## Footnotes

Here you can see the above details in a video:

Expand Down

0 comments on commit 87e44fc

Please sign in to comment.